11
11
from pip .baseparser import parser , ConfigOptionParser , UpdatingDefaultsHelpFormatter
12
12
from pip .download import urlopen
13
13
from pip .exceptions import BadCommand , InstallationError , UninstallationError
14
- from pip .venv import restart_in_venv
15
14
from pip .backwardcompat import StringIO , urllib , urllib2 , walk_packages
16
15
17
16
__all__ = ['command_dict' , 'Command' , 'load_all_commands' ,
@@ -45,8 +44,8 @@ def __init__(self):
45
44
46
45
def merge_options (self , initial_options , options ):
47
46
# Make sure we have all global options carried over
48
- for attr in ['log' , 'venv' , ' proxy' , 'venv_base ' , 'require_venv' ,
49
- 'respect_venv' , ' log_explicit_levels' , 'log_file' ,
47
+ for attr in ['log' , 'proxy' , 'require_venv' ,
48
+ 'log_explicit_levels' , 'log_file' ,
50
49
'timeout' , 'default_vcs' , 'skip_requirements_regex' ,
51
50
'no_input' ]:
52
51
setattr (options , attr , getattr (initial_options , attr ) or getattr (options , attr ))
@@ -73,44 +72,12 @@ def main(self, complete_args, args, initial_options):
73
72
74
73
self .setup_logging ()
75
74
76
- if options .require_venv and not options . venv :
75
+ if options .require_venv :
77
76
# If a venv is required check if it can really be found
78
77
if not os .environ .get ('VIRTUAL_ENV' ):
79
78
logger .fatal ('Could not find an activated virtualenv (required).' )
80
79
sys .exit (3 )
81
- # Automatically install in currently activated venv if required
82
- options .respect_venv = True
83
80
84
- if args and args [- 1 ] == '___VENV_RESTART___' :
85
- ## FIXME: We don't do anything this this value yet:
86
- args = args [:- 2 ]
87
- options .venv = None
88
- else :
89
- # If given the option to respect the activated environment
90
- # check if no venv is given as a command line parameter
91
- if options .respect_venv and os .environ .get ('VIRTUAL_ENV' ):
92
- if options .venv and os .path .exists (options .venv ):
93
- # Make sure command line venv and environmental are the same
94
- if (os .path .realpath (os .path .expanduser (options .venv )) !=
95
- os .path .realpath (os .environ .get ('VIRTUAL_ENV' ))):
96
- logger .fatal ("Given virtualenv (%s) doesn't match "
97
- "currently activated virtualenv (%s)."
98
- % (options .venv , os .environ .get ('VIRTUAL_ENV' )))
99
- sys .exit (3 )
100
- else :
101
- options .venv = os .environ .get ('VIRTUAL_ENV' )
102
- logger .info ('Using already activated environment %s' % options .venv )
103
- if options .venv :
104
- logger .info ('Running in environment %s' % options .venv )
105
- site_packages = False
106
- if options .site_packages :
107
- site_packages = True
108
- restart_in_venv (options .venv , options .venv_base , site_packages ,
109
- complete_args )
110
- # restart_in_venv should actually never return, but for clarity...
111
- return
112
-
113
- ## FIXME: not sure if this sure come before or after venv restart
114
81
if options .log :
115
82
log_fp = open_logfile (options .log , 'a' )
116
83
logger .consumers .append ((logger .DEBUG , log_fp ))
0 commit comments