コード例 #1
0
ファイル: __init__.py プロジェクト: hidde-jan/django-liberace
def _install_requirements():

    # Bootstrap with system specific way of installing pip and virtualenv
    system_specific_module(env.system).install_requirements(env)

    # Call user hook for this system
    #try:
    #globals()['install_requirements_'+env.system](env)
    env['install_requirements_'+env.system](env)
    #except KeyError:
    #    pass

    # Copy over previous environment if asked
    if env.virtualenv_copy_old:
        oldenv = os.path.join(env.current, env.virtualenv_dir)
        with cd(env.release_path):
            run('if [ -e %(oldenv)s ]; then cp -r %(oldenv)s .; fi' % locals())

    # Now create or update virtualenv and everything else
    with cd(env.release_path):
        run('virtualenv --no-site-packages %(virtualenv_dir)s' % env)
        ## We need to bootstrap into pip to avoid problems with old versions
        #run('%(activate)s; pip install pip==0.7.2' % env)
        run('%(activate)s; pip install -r %(requirements_file)s' % env)
コード例 #2
0
ファイル: __init__.py プロジェクト: hidde-jan/django-liberace
def detect():
    """Detect the system type of a remote host."""
    require('host')

    if 'system' in env:
        del env['system']

    # Start with uname and work from there
    with settings(shell='/bin/sh -c'):
        env.uname = run('uname -a')

    # Try and identify each system
    systems = []
    import liberace.systems
    for system in liberace.systems:
        try:
            if system_specific_module(system).identify(env):
                systems.append(system)
        except AttributeError:
            print system
            raise
         
    if len(systems) > 1:
        raise ValueError(
            'More than one system identified! %s identifies as %s' % (
                env.host_string,
                ', '.join(systems),
            )
        )
    elif len(systems) == 0:
        raise ValueError('Cannot identify system for host %(host_string)s' % env)
    else:
        env.system = systems[0]

    print '--> %(host_string)s is running %(system)s' % env
    _system_config()
コード例 #3
0
ファイル: __init__.py プロジェクト: hidde-jan/django-liberace
def _system_config():
    require('system')
    system_specific_module(env.system).settings(env)