diff options
author | Jannis Leidel <jannis@leidel.info> | 2012-02-16 21:09:00 +0100 |
---|---|---|
committer | Jannis Leidel <jannis@leidel.info> | 2012-02-16 21:09:00 +0100 |
commit | ee554dd82b8bc6ed9a3cf989b353126580fcc082 (patch) | |
tree | b0604f39ed465673316fe94ffa29046ed868aafc /pip/venv.py | |
parent | 47f1b2c2b2523469e6107cb2ef325eb61fa8fcf1 (diff) | |
parent | 40ac381fad2cc31f75014f02d3e8bf755d933abb (diff) | |
download | pip-1.1.tar.gz |
Merge branch 'release/1.1'1.1
Diffstat (limited to 'pip/venv.py')
-rw-r--r-- | pip/venv.py | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/pip/venv.py b/pip/venv.py deleted file mode 100644 index 88de4f6de..000000000 --- a/pip/venv.py +++ /dev/null @@ -1,53 +0,0 @@ -"""Tools for working with virtualenv environments""" - -import os -import sys -import subprocess -from pip.exceptions import BadCommand -from pip.log import logger - - -def restart_in_venv(venv, base, site_packages, args): - """ - Restart this script using the interpreter in the given virtual environment - """ - if base and not os.path.isabs(venv) and not venv.startswith('~'): - base = os.path.expanduser(base) - # ensure we have an abs basepath at this point: - # a relative one makes no sense (or does it?) - if os.path.isabs(base): - venv = os.path.join(base, venv) - - if venv.startswith('~'): - venv = os.path.expanduser(venv) - - if not os.path.exists(venv): - try: - import virtualenv - except ImportError: - print('The virtual environment does not exist: %s' % venv) - print('and virtualenv is not installed, so a new environment cannot be created') - sys.exit(3) - print('Creating new virtualenv environment in %s' % venv) - virtualenv.logger = logger - logger.indent += 2 - virtualenv.create_environment(venv, site_packages=site_packages) - if sys.platform == 'win32': - python = os.path.join(venv, 'Scripts', 'python.exe') - # check for bin directory which is used in buildouts - if not os.path.exists(python): - python = os.path.join(venv, 'bin', 'python.exe') - else: - python = os.path.join(venv, 'bin', 'python') - if not os.path.exists(python): - python = venv - if not os.path.exists(python): - raise BadCommand('Cannot find virtual environment interpreter at %s' % python) - base = os.path.dirname(os.path.dirname(python)) - file = os.path.join(os.path.dirname(__file__), 'runner.py') - if file.endswith('.pyc'): - file = file[:-1] - proc = subprocess.Popen( - [python, file] + args + [base, '___VENV_RESTART___']) - proc.wait() - sys.exit(proc.returncode) |