mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Fixes #24875: pip can now be installed in a venv with --system-site-packages.
This commit is contained in:
parent
a5917d1d15
commit
db6322cb8a
2 changed files with 25 additions and 9 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue