Esempio n. 1
0
def bootstrap_venv(intended_venv, bootstrap_name=None):
    # bootstrap wants options available in options.virtualenv which is a Bunch
    if os.path.exists(intended_venv):
        intended_venv.rmtree()

    venv = getattr(options, 'virtualenv', Bunch())

    with open(path(os.path.dirname(intended_venv)) / path('requirements.txt')) as reqs:
        # we expect this to be reversed in setup.py
        venv.packages_to_install = [line.strip() for line in reqs.readlines()[::-1] if line.strip()]

    venv.dest_dir = intended_venv
    if bootstrap_name:
        venv.script_name = '{}-bootstrap.py'.format(bootstrap_name)

    options.virtualenv = venv
    virtual.bootstrap()
    if sys.executable:
        # if we can figure out the python associated with this paver, execute the bootstrap script
        # and we can expect the virtual env will then exist
        sh('{python_path} "{script_name}"'.format(python_path=sys.executable,
                                                  script_name=venv.script_name))

        # we're going to assume that worked, so run setup.py develop
        develop_plugin(intended_venv)
Esempio n. 2
0
def bootstrap_venv(intended_venv, bootstrap_name=None):
    # bootstrap wants options available in options.virtualenv which is a Bunch
    if exists(intended_venv):
        intended_venv.rmtree()

    venv = getattr(options, 'virtualenv', Bunch())

    with open(path(dirname(intended_venv)) / path('requirements.txt')) as reqs:
        # we expect this to be reversed in setup.py
        venv.packages_to_install = [
            line.strip() for line in reqs.readlines()[::-1] if line.strip()
        ]

    venv.dest_dir = intended_venv
    if bootstrap_name:
        venv.script_name = '{}-bootstrap.py'.format(bootstrap_name)

    options.virtualenv = venv
    virtual.bootstrap()
    if sys.executable:
        # if we can figure out the python associated with this paver, execute the bootstrap script
        # and we can expect the virtual env will then exist
        sh('{python_path} "{script_name}"'.format(
            python_path=sys.executable, script_name=venv.script_name))
Esempio n. 3
0
def install():
    virtual.bootstrap()
    sh('python ./bootstrap-venv.py')