Skip to content

Commit 9f44cad

Browse files
authored
Adapt for pip 10 changing location of main
This is really a special case hack. The only reason that I'm okay with importing from pip's internals here is because we're using pip to install pip and this is really the cleanest way to allow for the bootstrapping to work. Further, the script doesn't break any of pip's internal assumptions (like sole control of logging) so this is fine.
1 parent e592265 commit 9f44cad

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

virtualenv.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,10 @@ def space_path2url(p):
858858
import tempfile
859859
import os
860860
861-
import pip
861+
try:
862+
from pip._internal import main as _main
863+
except ImportError:
864+
from pip import main as _main
862865
863866
cert_data = pkgutil.get_data("pip._vendor.requests", "cacert.pem")
864867
if cert_data is not None:
@@ -874,7 +877,7 @@ def space_path2url(p):
874877
args += ["--cert", cert_file.name]
875878
args += sys.argv[1:]
876879
877-
sys.exit(pip.main(args))
880+
sys.exit(_main(args))
878881
finally:
879882
if cert_file is not None:
880883
os.remove(cert_file.name)

0 commit comments

Comments
 (0)