示例#1
0
    def update_ve(self, full_rebuild, force_update):

        if not path.exists(self.requirements):
            print >> sys.stderr, "Could not find requirements: file %s" % self.requirements
            return 1

        update_required = self.virtualenv_needs_update()

        if not update_required and not force_update:
            # Nothing to be done
            print "VirtualEnv does not need to be updated"
            print "use --force to force an update"
            return 0

        # if we need to create the virtualenv, then we must do that from
        # outside the virtualenv. The code inside this if statement will only
        # be run outside the virtualenv.
        if full_rebuild and path.exists(self.ve_dir):
            shutil.rmtree(self.ve_dir)
        if not path.exists(self.ve_dir):
            import virtualenv
            virtualenv.logger = virtualenv.Logger(consumers=[])
            virtualenv.create_environment(self.ve_dir, site_packages=False)

        # install the pip requirements and exit
        pip_path = path.join(self.ve_dir, 'bin', 'pip')
        # use cwd to allow relative path specs in requirements file, e.g. ../tika
        pip_retcode = subprocess.call(
                [pip_path, 'install', '--requirement=%s' % self.requirements],
                cwd=os.path.dirname(self.requirements))
        if pip_retcode == 0:
            self.update_ve_timestamp()
        return pip_retcode
示例#2
0
def test_pypy_pre_import(tmp_path):
    """For PyPy, some built-in modules should be pre-imported because
    some programs expect them to be in sys.modules on startup.
    """
    check_code = inspect.getsource(check_pypy_pre_import)
    check_code = textwrap.dedent(check_code[check_code.index("\n") + 1 :])
    if six.PY2:
        check_code = check_code.decode()

    check_prog = tmp_path / "check-pre-import.py"
    check_prog.write_text(check_code)

    ve_path = str(tmp_path / "venv")
    virtualenv.create_environment(ve_path)

    bin_dir = virtualenv.path_locations(ve_path)[-1]

    try:
        cmd = [
            os.path.join(bin_dir, "{}{}".format(virtualenv.EXPECTED_EXE, ".exe" if virtualenv.IS_WIN else "")),
            str(check_prog),
        ]
        subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError as exception:
        assert not exception.returncode, exception.output
示例#3
0
文件: env.py 项目: j2labs/bpm
def env_create(args):
    import virtualenv

    settings = load_settings()
    
    ### Create virtualenv
    virtualenv.create_environment(settings.dir_virtualenv)
    py_reqs = ['brubeck', 'dictshield', 'ujson']

    ### Ask about preferences
    web_server = ask_webserver(settings)
    if web_server == ENV_M2:
        py_reqs.append('pyzmq')
        
    concurrency = ask_concurrency(settings)
    py_reqs.append(concurrency)
    if concurrency == ENV_GEVENT:
        py_reqs.append('cython')
    
    template_engines = ask_template_engines(settings)
    py_reqs = py_reqs + template_engines

    ### Install web server requirements
    if web_server == ENV_M2:
        install_mongrel2(settings)

    ### pip install requirements
    response = install_with_pip(py_reqs)
示例#4
0
文件: venv.py 项目: cgestes/qibuild
def configure_virtualenv(config, python_worktree,  build_worktree=None,
                         remote_packages=None, site_packages=True):
    if not remote_packages:
        remote_packages = list()

    # create a new virtualenv
    python_worktree.config = config
    venv_path = python_worktree.venv_path
    pip = python_worktree.pip

    try:
        virtualenv.create_environment(python_worktree.venv_path,
                                      site_packages=site_packages)
    except:
        ui.error("Failed to create virtualenv")
        return

    # Install all Python projects using pip install -e .
    python_projects = python_worktree.python_projects
    for i, project in enumerate(python_projects):
        ui.info_count(i, len(python_projects),
                     ui.green, "Configuring", ui.reset, ui.blue, project.src)
        cmd = [pip, "install", "--editable", "."]
        qisys.command.call(cmd, cwd=project.path)

    # Write a qi.pth file containing path to C/C++ extensions
    if build_worktree:
        handle_extensions(venv_path, python_worktree, build_worktree)

    # Install the extension in the virtualenv
    binaries_path = virtualenv.path_locations(venv_path)[-1]
    pip_binary = os.path.join(binaries_path, "pip")
    if remote_packages:
        cmd = [pip_binary, "install"] + remote_packages
        subprocess.check_call(cmd)
示例#5
0
    def install(self):
        # Create a new virtualenv in the temp install location
        import virtualenv
        virtualenv.create_environment(
            self.install_dir,
            site_packages=False
        )
        # chdir into the pecan source
        os.chdir(pkg_resources.get_distribution('pecan').location)

        py_exe = os.path.join(self.install_dir, 'bin', 'python')
        pecan_exe = os.path.join(self.install_dir, 'bin', 'pecan')

        # env/bin/python setup.py develop (pecan)
        subprocess.check_call([
            py_exe,
            'setup.py',
            'develop'
        ])
        # create the templated project
        os.chdir(self.install_dir)
        subprocess.check_call([pecan_exe, 'create', 'Testing123'])

        # move into the new project directory and install
        os.chdir('Testing123')
        subprocess.check_call([
            py_exe,
            'setup.py',
            'develop'
        ])
def prepare_virtualenv(packages=()):
    """
    Prepares a virtual environment.
    :rtype : VirtualEnvDescription
    """
    vroot = get_vroot()
    env_key = get_env_key(packages)
    vdir = os.path.join(vroot, env_key)

    vbin = os.path.join(vdir, ('bin', 'Scripts')[_windows])
    exe_suffix = ("", ".exe")[_windows]
    vpython = os.path.join(vbin, 'python' + exe_suffix)
    vpip = os.path.join(vbin, 'pip' + exe_suffix)
    venv_description = VirtualEnvDescription(home_dir=vdir, bin_dir=vbin, python=vpython, pip=vpip, packages=packages)

    env = get_clean_system_environment()
    env['PIP_DOWNLOAD_CACHE'] = os.path.abspath(os.path.join(vroot, "pip-download-cache"))

    # Cache environment
    done_flag_file = os.path.join(vdir, "done")
    if not os.path.exists(done_flag_file):
        if os.path.exists(vdir):
            shutil.rmtree(vdir)

        virtualenv.create_environment(vdir)

        for package_spec in packages:
            subprocess.call([vpip, "install", package_spec], env=env)

        open(done_flag_file, 'a').close()

    subprocess.call([vpython, "setup.py", "install"], env=env)

    return venv_description
示例#7
0
def run_tests(payload):
    #payload = get_payload(payload_id)
    job = get_current_job()

    # work out the repo_url
    repo_name = payload['repository']['name']
    owner = payload['repository']['owner']['name']
    repo_url = "[email protected]:%s/%s.git" % (owner, repo_name)

    update_progress(job, 'repo url: %s' % repo_url)
    logger.info("repo: %s" % repo_url)

    vpath = tempfile.mkdtemp(suffix="ridonkulous")

    logger.info("cloning repo %s to: %s" % (repo_url, vpath))
    update_progress(job, "cloning repo %s to: %s" % (repo_url, vpath))

    create_environment(vpath, site_packages=False)

    os.chdir(vpath)

    git.Git().clone(repo_url)
    os.chdir(os.path.join(vpath, repo_name))

    pip = "%s/bin/pip" % vpath
    #python = "%s/bin/python"
    nose = "%s/bin/nosetests" % vpath

    ret = subprocess.call(r'%s install -r requirements.txt --use-mirrors' % pip, shell=True)

    logger.info("running nose")
    ret = subprocess.call(r'%s' % nose, shell=True)
    logger.info(ret)
    update_progress(job, 'done')
    return 'ok'
示例#8
0
文件: venv.py 项目: akaihola/pip
 def _create(self, clear=False):
     if clear:
         self.location.rmtree()
     if self._template:
         # On Windows, calling `_virtualenv.path_locations(target)`
         # will have created the `target` directory...
         if sys.platform == 'win32' and self.location.exists:
             self.location.rmdir()
         # Clone virtual environment from template.
         self._template.location.copytree(self.location)
         self._sitecustomize = self._template.sitecustomize
         self._user_site_packages = self._template.user_site_packages
     else:
         # Create a new virtual environment.
         if self._venv_type == 'virtualenv':
             _virtualenv.create_environment(
                 self.location,
                 no_pip=True,
                 no_wheel=True,
                 no_setuptools=True,
             )
             self._fix_virtualenv_site_module()
         elif self._venv_type == 'venv':
             builder = _venv.EnvBuilder()
             context = builder.ensure_directories(self.location)
             builder.create_configuration(context)
             builder.setup_python(context)
             self.site.makedirs()
         self.sitecustomize = self._sitecustomize
         self.user_site_packages = self._user_site_packages
示例#9
0
def install(package):
    if not os.path.exists('.env'):
        print('Creating virtualenv')
        create_environment('.env', never_download=True)

    print('Installing %s' % package)
    pip.main(['install', package, '-t',  os.environ['PWD'] + '/.env/lib/python2.7/site-packages/','--log-file', '.env/ppm.log'])
示例#10
0
    def build(cls, path, key, options, force=False):
        ''' Build a virtual environment in specified path, according to given
        key and options. '''

        virtualenv.logger = virtualenv.Logger(
            [(virtualenv.Logger.level_for_integer(2), sys.stderr)])

        # a simple check that what we want to remove looks like a ve name :)
        if force and os.path.exists(path):
            if len(os.path.basename(path)) == 32:
                shutil.rmtree(path)
            else:
                raise AssertionError("Ah, you probably do not want to delete "
                                     "%s, do you?" % path)

        os.makedirs(path)
        virtualenv.create_environment(home_dir=path)
        ve = VirtualEnv(path)

        # "fix" bug in pip
        # (see: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677801)
        if options.fix_pip:
            fragments_file = 'local/lib/python2.7/site-packages/' \
                             'pip-1.1-py2.7.egg/pip/vcs/__init__.py'
            ve.execlp("sed", "-ie",
                      "/urlparse.uses_fragment.extend(self.schemes)/d",
                      ve.local_path(fragments_file))
            ve.unlink(fragments_file + 'c')

        key.initialize(ve)

        ve.mark_as_good()

        return ve
示例#11
0
文件: venv.py 项目: 510908220/pip
    def _create(self, clear=False):
        # Create the actual virtual environment
        _virtualenv.create_environment(
            self.location,
            clear=clear,
            never_download=True,
            no_pip=True,
        )

        # Install our development version of pip install the virtual
        # environment
        cmd = [self.bin.join("python"), "setup.py", "install", "--no-compile"]
        p = subprocess.Popen(
            cmd,
            cwd=self.pip_source_dir,
            stderr=subprocess.STDOUT,
            stdout=DEVNULL,
        )
        p.communicate()
        if p.returncode != 0:
            raise subprocess.CalledProcessError(
                p.returncode,
                cmd,
                output=p.stdout,
            )
示例#12
0
def create_virtual_env(project_path, install_path):
    # remove existing virtual env if exists
    ve_path = os.path.join(project_path, cfg.VIRTUAL_ENV_PATH)
    if os.path.exists(ve_path):
        shutil.rmtree(ve_path)
    try:
        logger.info('creating virtual env')
        virtualenv.create_environment(ve_path)
    except Exception:
        logger.exception('failed to create virtualenv: ')
        raise Exception('failed to create virtualenv!')
    try:
        logger.info('installing requirements for virtualenv')
        # update pip to latest version
        run_command(['{}/ve/bin/pip'.format(project_path),
                     'install',
                     '-U',
                     'pip'])

        if not os.path.exists('{}/requirements.txt'.format(project_path)):
            logger.warning('requirements.txt not found')
            return ve_path

        run_command(['{}/ve/bin/pip'.format(project_path),
                     'install',
                     '-r',
                     '{}/requirements.txt'.format(project_path)])
        virtualenv.make_environment_relocatable(ve_path)
        fixup_scripts(install_path, ve_path)
    except Exception:
        logger.exception('failed to install requirements! error message:')
        raise Exception('fail to install requirements.')
    return ve_path
    def __init__(self, binPath, profilePath, password=None):
        self.venvDir = tempfile.mkdtemp()
        self.leafName = os.path.basename(__file__)
        self.binDir = os.path.join(self.venvDir, 'bin')
        self.profilePath = profilePath
        self.password = password
        self.subproc = None

        # create the virtualenv
        virtualenv.create_environment(self.venvDir,
            site_packages=True,
            never_download=True,
            no_pip=True,
            no_setuptools=True
        )

        # copy libraries
        if sys.platform == "linux2":
            dllfiles = "*.so"
        elif sys.platform == "darwin":
            dllfiles = "*.dylib"
        elif sys.platform == "win32":
            dllfiles = "*.dll"

        files = glob.glob(os.path.join(binPath, dllfiles))
        if not len(files):
            raise Exception("Could not find libraries in " + binPath)

        for filename in files:
            shutil.copy(filename, self.binDir)

        # copy our script
        shutil.copy(__file__, self.binDir)
示例#14
0
def main():
    if not requirements_modified_time > environment_modified_time:
        print 'Environment already up-to-date'
        return

    import virtualenv
    import subprocess

    if path.exists(VE_ROOT):
        shutil.rmtree(VE_ROOT)
    virtualenv.logger = virtualenv.Logger(consumers=[])
    virtualenv.create_environment(VE_ROOT, site_packages=False)

    # check requirements
    if not path.exists(PIP_CACHE_ROOT):
        os.mkdir(PIP_CACHE_ROOT)

    PIP_BASE = [VE_PIP, 'install', '-q', '-i',
                'https://simple.crate.io/',
                '--extra-index-url', 'http://e.pypi.python.org/simple',
                '--download-cache=%s' % (PIP_CACHE_ROOT,),]
    for req in REQUIREMENTS:
        subprocess.call(PIP_BASE + ['-r', req])

    file(VE_TIMESTAMP, 'w').close()
def bootstrap(folder):
    print("+- Loading pip:", end='')
    try:
        from pip.req import InstallRequirement
    except:
        print(" failed....")
        raise
    print(" done")

    try:
        print("+- Creating virtual enviroment: ", end='')
        virtualenv.create_environment(folder, site_packages=True, clear=False)
        print(" %s" % folder)
    except Exception as e:
        print(""" failed....
                - Error instanciating the virutal enviroment. This is a catastrophic failure...
                - Something is really wrong with this Python installation

                - You could try to manually install virtualenv via:
                sudo python -m pip install -U virtualenv
                """)
        raise
    else:
        return
    finally:
        pass
示例#16
0
def test_create_environment_from_virtual_environment(tmpdir):
    """Create virtual environment using Python from another virtual environment
    """
    venvdir = str(tmpdir / "venv")
    home_dir, lib_dir, inc_dir, bin_dir = virtualenv.path_locations(venvdir)
    virtualenv.create_environment(venvdir)
    assert not os.path.islink(os.path.join(lib_dir, "distutils"))
示例#17
0
def test_relative_symlink(tmpdir):
    """ Test if a virtualenv works correctly if it was created via a symlink and this symlink is removed """

    tmpdir = str(tmpdir)
    ve_path = os.path.join(tmpdir, "venv")
    os.mkdir(ve_path)

    workdir = os.path.join(tmpdir, "work")
    os.mkdir(workdir)

    ve_path_linked = os.path.join(workdir, "venv")
    os.symlink(ve_path, ve_path_linked)

    lib64 = os.path.join(ve_path, "lib64")

    virtualenv.create_environment(ve_path_linked, symlink=True)
    if not os.path.lexists(lib64):
        # no lib 64 on this platform
        return

    assert os.path.exists(lib64)

    shutil.rmtree(workdir)

    assert os.path.exists(lib64)
示例#18
0
    def run(self):
        # generate the metadata first
        self.run_command('egg_info')

        venv_dir = self.bdist_dir

        virtualenv.create_environment(
            venv_dir,
            never_download=True,
        )

        pip_cmd = [os.path.join(venv_dir, 'bin', 'pip'), 'install', '.']
        if self.requirements:
            pip_cmd.extend(['-r', self.requirements])
        subprocess.check_call(pip_cmd)

        self.copy_file(os.path.join(self.egg_info, 'PKG-INFO'), venv_dir)

        virtualenv.make_environment_relocatable(venv_dir)

        log.info("creating '%s' and adding '%s' to it", self.venv_output,
                 venv_dir)
        mkpath(os.path.dirname(self.venv_output))

        with closing(tarfile.open(self.venv_output, 'w:gz')) as tar:
            tar.add(venv_dir, self.archive_root)

        self.distribution.dist_files.append(('bdist_venv', get_python_version(),
                                             self.venv_output))

        if not self.keep_temp:
            remove_tree(venv_dir)
示例#19
0
文件: vw-script.py 项目: akx/vw
def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("env")
    ap.add_argument("-w", "--workdir", dest="workdir")
    args = ap.parse_args()
    env_path = os.path.join(ENVS_PATH, args.env)
    if not os.path.isdir(env_path):
        if raw_input("%s (for %s) does not exist. Create new virtualenv? [y/n] " % (env_path, args.env)) == "y":
            virtualenv.logger = virtualenv.Logger([(virtualenv.Logger.NOTIFY, sys.stdout)])
            virtualenv.create_environment(env_path, site_packages=True, unzip_setuptools=True)
        else:
            print "Abort."
            sys.exit(1)

    if args.workdir:
        workdir = os.path.realpath(args.workdir)
        if os.path.isdir(workdir):
            print "Setting environment %s workdir to '%s'." % (args.env, workdir)
            file(os.path.join(env_path, "workdir"), "wb").write(workdir)
    
    activation_script_path = os.environ.get("VW_ACTSCRIPT_PATH")
    if not activation_script_path:
        print "VW_ACTSCRIPT_PATH not set, not creating activation script"
    else:
        with file(activation_script_path, "wb") as actscript:
            actscript.write(gen_activation_script(env_path))
示例#20
0
def init(config, args):
    """Create a new WSGI project skeleton and config."""
    
    log = logging.getLogger('kraftwerk.init')
    
    # project_root/src_root
    project_root = os.path.abspath(os.path.join(os.getcwd(), args.title))
    src_root = os.path.join(project_root, args.title)
    
    if os.path.exists(project_root) and os.listdir(project_root):
        init.parser.error("Directory exists and isn't empty")
    elif not os.path.exists(project_root):
        log.debug('makedirs %s' % project_root)
        os.makedirs(project_root)
    elif not os.path.isdir(project_root):
        init.parser.error("A file with this name already exists here and isn't a directory")
    
    log.debug('virtualenv %s/' % args.title)
    logger = virtualenv.Logger([
                 (virtualenv.Logger.level_for_integer(2), sys.stdout)])
    virtualenv.logger = logger
    virtualenv.create_environment(args.title, site_packages=True)
    
    log.debug('mkdir %s/service/' % project_root)
    os.makedirs(os.path.join(args.title, 'service'))
    log.debug('mkdir %s/static/' % project_root)
    os.makedirs(os.path.join(args.title, 'static'))
    log.debug('mkdir %s/' % src_root)
    os.makedirs(src_root)
    
    _copy_project(config, args.title, project_root)
    print "Your new project is at: %s" % project_root
示例#21
0
def test_dist_missing_data(testdir):
    venv_path = os.path.join(str(testdir.tmpdir), 'venv')
    virtualenv.create_environment(venv_path)
    if sys.platform == 'win32':
        exe = os.path.join(venv_path, 'Scripts', 'python.exe')
    else:
        exe = os.path.join(venv_path, 'bin', 'python')
    subprocess.check_call([
        exe,
        '-mpip' if sys.version_info >= (2, 7) else '-mpip.__main__',
        'install',
        'py==%s' % py.__version__,
        'pytest==%s' % pytest.__version__
    ])
    script = testdir.makepyfile(SCRIPT)

    result = testdir.runpytest('-v',
                               '--cov=%s' % script.dirpath(),
                               '--cov-report=term-missing',
                               '--dist=load',
                               '--tx=popen//python=%s' % exe,
                               '--max-slave-restart=0',
                               script)

    result.stdout.fnmatch_lines([
        '*- coverage: failed slaves -*'
    ])
    assert result.ret == 0
def virtualenv(request):
    """ Create a virtualenv and ``chdir`` into it.  Remove it and ``chdir``
    into the previous working directory again when the test has been run.
    """

    import virtualenv
    from virtualenv import Logger

    # create a temp directory
    cwd = os.getcwd()
    virtualenv_directory = mkdtemp()

    # install a virtualenv
    logger = Logger([(Logger.level_for_integer(2), sys.stdout)])
    virtualenv.logger = logger
    virtualenv.create_environment(
        virtualenv_directory,
        site_packages=False,
        clear=True,
        unzip_setuptools=True)

    # chdir into the virtualenv directory
    os.chdir(virtualenv_directory)

    # update setuptools in the virtualenv
    subprocess.check_call([
        os.path.join('bin', 'pip'),
        'install', '-U', 'setuptools>=17.1'])

    # install requirements.txt into the virtualenv
    subprocess.check_call([
        os.path.join('bin', 'pip'),
        'install', '-r',
        os.path.join(cwd, 'requirements.txt')])

    # also install psycopg2 and oursql
    subprocess.check_call([
        os.path.join('bin', 'pip'),
        'install', 'psycopg2', 'oursql'])

    # setuptools-git is required to be able to call setup.py install
    # sucessfully.
    subprocess.check_call([
        os.path.join('bin', 'pip'),
        'install', 'setuptools-git'])

    shutil.copytree(cwd, os.path.join(virtualenv_directory, 'kotti'))

    # install Kotti into the virtualenv
    os.chdir('kotti')
    subprocess.check_call([
        os.path.join('..', 'bin', 'python'), 'setup.py', 'develop'])
    os.chdir('..')

    def delete_virtualenv():
        shutil.rmtree(virtualenv_directory)
        os.chdir(cwd)

    request.addfinalizer(delete_virtualenv)
示例#23
0
def main():
    p = argparse.ArgumentParser(usage=__doc__.strip())
    args = p.parse_args()

    try:
        import virtualenv
    except ImportError:
        print("ERROR: You need to install Virtualenv (https://pypi.python.org/pypi/virtualenv) first")
        sys.exit(0)

    try:
        find_python()
    except RuntimeError:
        print("\n-- Creating virtualenv in deploy/env")
        print("$ virtualenv %s" % VENV_DIR)
        virtualenv.create_environment(VENV_DIR)

    python_bin, easy_install_bin = find_python()

    os.chdir(ROOT_DIR)

    print("\n-- Installing required modules")
    with open("requirements.txt", "r") as f:
        requirements = [x.strip() for x in f.read().splitlines() if x.strip()]

    if sys.platform.startswith("win"):
        # Download the windows binary
        requirements = [MERCURIAL_WIN_BINARY if x.lower().startswith("mercurial") else x for x in requirements]

    run_cmd([easy_install_bin] + requirements)

    print("\n-- Setting up development database")
    print("$ cd deploy")
    os.chdir(DEPLOY_DIR)
    run_cmd([python_bin, "manage.py", "syncdb"])
    run_cmd([python_bin, "manage.py", "migrate"])
    run_cmd([python_bin, "manage.py", "loaddata", "base"])
    run_cmd([python_bin, "manage.py", "loaddata", "sample"])
    run_cmd([python_bin, "manage.py", "rebuild_index"])

    print(
        r"""
-- All done!

Now you can do:

* Linux & OSX:

      cd deploy
      source env/bin/activate
      python manage.py runserver

* Windows:

      cd deploy
      env\Scripts\activate
      python manage.py runserver
"""
    )
 def venv(self, reason):
     path = self.useFixture(fixtures.TempDir()).path
     virtualenv.create_environment(path, clear=True)
     python = os.path.join(path, 'bin', 'python')
     self.useFixture(base.CapturedSubprocess(
         'mkvenv-' + reason, [python] + PIP_CMD + [
             '-U', PIPVERSION, 'wheel', PBRVERSION]))
     return path, python
示例#25
0
def create_virtualenv(where, distribute=False):
    import virtualenv
    if sys.version_info[0] > 2:
        distribute = True
    virtualenv.create_environment(
        where, use_distribute=distribute, unzip_setuptools=True)

    return virtualenv.path_locations(where)
示例#26
0
def setup():
    global testenv_dir
    ip = get_ipython()
    #creating a testing virtualenv
    testenv_dir = TemporaryDirectory()
    os.environ['WORKON_HOME'] = testenv_dir.name
    virtualenv.create_environment(os.path.join(testenv_dir.name,'testenv'))
    ip.extension_manager.load_extension('virtualenvmagic')
示例#27
0
文件: fixture.py 项目: ev-br/testrig
    def setup(self):
        BaseFixture.setup(self)

        with VIRTUALENV_LOCK:
            virtualenv.create_environment(self.env_dir)
            self._debian_fix()

            self.env_install(['pip==8.0.2'])
示例#28
0
 def create(cls, path=None, create_if_not_exist=False):
     if path is None:
         path = tempfile.mkdtemp()
     if create_if_not_exist and not os.path.exists(path):
         os.mkdirs(path)
     ve = cls(path)
     virtualenv.create_environment(path)
     return ve
示例#29
0
def virtualenv():
    "Prepares a checked out directory for development"
    if not os.path.exists(os.path.join('bin', 'pip')):
        sys.path.insert(0, os.path.join('deps', 'virtualenv.zip'))
        import virtualenv
        virtualenv.create_environment('.')
    else:
        print('Virtualenv already set up')
示例#30
0
def install_virtualenv(install_dir):
    _ensure_distutils_config(install_dir)
    if is_virtualenv(install_dir):
        return

    create_environment(install_dir, no_setuptools=False,
                       no_pip=True, site_packages=False,
                       symlink=False)