1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
This commit is contained in:
Jannis Leidel 2009-05-14 12:10:34 +02:00
commit 949f4143aa
3 changed files with 17 additions and 4 deletions

1
.hgsigs Normal file
View file

@ -0,0 +1 @@
624327302f101ed9d3b832bcce4ab21c072b7a06 0 iEYEABECAAYFAknsrg0ACgkQsXMn1AFx3zACyQCfVC9Ax9UGWHzNwwBx4dTyZcg1edUAnRhbhHwT/cLiUgT29+kh7fFPcgXf

View file

@ -25,6 +25,9 @@ hg tip
* Fix the way bundle components are unpacked and moved around, to make
bundles work.
* Adds ``-s`` option to allow the access to the global site-packages if a
virtualenv is to be created.
0.3.1
-----

17
pip.py
View file

@ -160,6 +160,13 @@ parser.add_option(
metavar='DIR',
help='virtualenv environment to run pip in (either give the '
'interpreter or the environment base directory)')
parser.add_option(
'-s', '--enable-site-packages',
dest='site_packages',
action='store_true',
help='Include site-packages in virtualenv if one is to be '
'created. Ignored if --environment is not used or '
'the virtualenv already exists.')
parser.add_option(
'-v', '--verbose',
dest='verbose',
@ -245,7 +252,10 @@ class Command(object):
if options.verbose > 0:
# The logger isn't setup yet
print 'Running in environment %s' % options.venv
restart_in_venv(options.venv, complete_args)
site_packages=False
if options.site_packages:
site_packages=True
restart_in_venv(options.venv, site_packages, complete_args)
# restart_in_venv should actually never return, but for clarity...
return
## FIXME: not sure if this sure come before or after venv restart
@ -953,7 +963,7 @@ def format_exc(exc_info=None):
traceback.print_exception(*exc_info, **dict(file=out))
return out.getvalue()
def restart_in_venv(venv, args):
def restart_in_venv(venv, site_packages, args):
"""
Restart this script using the interpreter in the given virtual environment
"""
@ -979,8 +989,7 @@ def restart_in_venv(venv, args):
print 'Creating new virtualenv environment in %s' % venv
virtualenv.logger = logger
logger.indent += 2
## FIXME: always have no_site_packages?
virtualenv.create_environment(venv, site_packages=False)
virtualenv.create_environment(venv, site_packages=site_packages)
if sys.platform == 'win32':
python = os.path.join(venv, 'Scripts', 'python.exe')
else: