def installed_from_source(version=VERSION):
 from fabtools.require import directory as require_directory
 from fabtools.require import file as require_file
 from fabtools.require import user as require_user
 from fabtools.require.deb import packages as require_deb_packages
 from fabtools.require.rpm import packages as require_rpm_packages
 family = distrib_family()
 if (family == 'debian'):
  require_deb_packages(['build-essential'])
 elif (family == 'redhat'):
  require_rpm_packages(['gcc', 'make'])
 require_user('redis', home='/var/lib/redis', system=True)
 require_directory('/var/lib/redis', owner='redis', use_sudo=True)
 dest_dir = ('/opt/redis-%(version)s' % locals())
 require_directory(dest_dir, use_sudo=True, owner='redis')
 if (not is_file(('%(dest_dir)s/redis-server' % locals()))):
  with cd('/tmp'):
   tarball = ('redis-%(version)s.tar.gz' % locals())
   url = (_download_url(version) + tarball)
   require_file(tarball, url=url)
   run(('tar xzf %(tarball)s' % locals()))
   with cd(('redis-%(version)s' % locals())):
    run('make')
    for filename in BINARIES:
     run_as_root(('cp -pf src/%(filename)s %(dest_dir)s/' % locals()))
     run_as_root(('chown redis: %(dest_dir)s/%(filename)s' % locals()))

def installed_from_source ( version = VERSION ) : from fabtools . require import directory as require_directory from fabtools . require import file as require_file from fabtools . require import user as require_user from fabtools . require . deb import packages as require_deb_packages from fabtools . require . rpm import packages as require_rpm_packages family = distrib_family ( ) if ( family == 'debian' ) : require_deb_packages ( [ 'build-essential' ] ) elif ( family == 'redhat' ) : require_rpm_packages ( [ 'gcc' , 'make' ] ) require_user ( 'redis' , home = '/var/lib/redis' , system = True ) require_directory ( '/var/lib/redis' , owner = 'redis' , use_sudo = True ) dest_dir = ( '/opt/redis-%(version)s' % locals ( ) ) require_directory ( dest_dir , use_sudo = True , owner = 'redis' ) if ( not is_file ( ( '%(dest_dir)s/redis-server' % locals ( ) ) ) ) : with cd ( '/tmp' ) : tarball = ( 'redis-%(version)s.tar.gz' % locals ( ) ) url = ( _download_url ( version ) + tarball ) require_file ( tarball , url = url ) run ( ( 'tar xzf %(tarball)s' % locals ( ) ) ) with cd ( ( 'redis-%(version)s' % locals ( ) ) ) : run ( 'make' ) for filename in BINARIES : run_as_root ( ( 'cp -pf src/%(filename)s %(dest_dir)s/' % locals ( ) ) ) run_as_root ( ( 'chown redis: %(dest_dir)s/%(filename)s' % locals ( ) ) )
require node .