summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPradyun Gedam <pradyunsg@gmail.com>2017-10-20 18:31:54 +0530
committerGitHub <noreply@github.com>2017-10-20 18:31:54 +0530
commit9f44cad996ae6f97ba954f238f3f85a1ede1378c (patch)
treec6957de43903cdad76865631664077ab1b8a3c5f
parente5922654e10c4c5494241112a3645079db186222 (diff)
downloadvirtualenv-9f44cad996ae6f97ba954f238f3f85a1ede1378c.tar.gz
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.
-rwxr-xr-xvirtualenv.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/virtualenv.py b/virtualenv.py
index d1c487f..515ac34 100755
--- a/virtualenv.py
+++ b/virtualenv.py
@@ -858,7 +858,10 @@ def install_wheel(project_names, py_executable, search_dirs=None,
import tempfile
import os
- import pip
+ try:
+ from pip._internal import main as _main
+ except ImportError:
+ from pip import main as _main
cert_data = pkgutil.get_data("pip._vendor.requests", "cacert.pem")
if cert_data is not None:
@@ -874,7 +877,7 @@ def install_wheel(project_names, py_executable, search_dirs=None,
args += ["--cert", cert_file.name]
args += sys.argv[1:]
- sys.exit(pip.main(args))
+ sys.exit(_main(args))
finally:
if cert_file is not None:
os.remove(cert_file.name)