diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-02-02 19:05:19 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-02-02 19:05:19 (GMT) |
commit | db6322cb8ac1a8edede92e1aa1e3c688742a7923 (patch) | |
tree | d71ee62094614d075d89d46b7bd0d99451caf660 /Lib/venv | |
parent | a5917d1d1584bb9f7affec5a5d66bb2d24d7623e (diff) | |
download | cpython-db6322cb8ac1a8edede92e1aa1e3c688742a7923.zip cpython-db6322cb8ac1a8edede92e1aa1e3c688742a7923.tar.gz cpython-db6322cb8ac1a8edede92e1aa1e3c688742a7923.tar.bz2 |
Fixes #24875: pip can now be installed in a venv with --system-site-packages.
Diffstat (limited to 'Lib/venv')
-rw-r--r-- | Lib/venv/__init__.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py index 74245ab..fa03262 100644 --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -77,6 +77,10 @@ class EnvBuilder: """ env_dir = os.path.abspath(env_dir) context = self.ensure_directories(env_dir) + # See issue 24875. We need system_site_packages to be False + # until after pip is installed. + true_system_site_packages = self.system_site_packages + self.system_site_packages = False self.create_configuration(context) self.setup_python(context) if self.with_pip: @@ -84,6 +88,11 @@ class EnvBuilder: if not self.upgrade: self.setup_scripts(context) self.post_setup(context) + if true_system_site_packages: + # We had set it to False before, now + # restore it and rewrite the configuration + self.system_site_packages = True + self.create_configuration(context) def clear_directory(self, path): for fn in os.listdir(path): |