mirror of https://github.com/pypa/pip
Swap venv and virtualenv checks
Environments created by pypa/virtualenv >=20 can pass both real_prefix and base_prefix checks, but are only able to use the pyvenv.cfg values, not the legacy `no-global-site-packages.txt`. So we need to check for venv (PEP 405) first.
This commit is contained in:
parent
723b84517d
commit
6104060580
|
@ -0,0 +1,2 @@
|
|||
Correctly detect global site-packages availability of virtual environments
|
||||
created by PyPA’s virtualenv>=20.0.
|
|
@ -105,11 +105,12 @@ def virtualenv_no_global():
|
|||
# type: () -> bool
|
||||
"""Returns a boolean, whether running in venv with no system site-packages.
|
||||
"""
|
||||
# PEP 405 compliance needs to be checked first since virtualenv >=20 would
|
||||
# return True for both checks, but is only able to use the PEP 405 config.
|
||||
if _running_under_venv():
|
||||
return _no_global_under_venv()
|
||||
|
||||
if _running_under_regular_virtualenv():
|
||||
return _no_global_under_regular_virtualenv()
|
||||
|
||||
if _running_under_venv():
|
||||
return _no_global_under_venv()
|
||||
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue