Skip to content

Commit

Permalink
Virtualenv no longer uses no-global-site-packages.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzymadness committed Sep 1, 2020
1 parent 88ca32a commit 6d69ce1
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions src/pip/_internal/utils/virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,10 @@ def _no_global_under_venv():
return False


def _no_global_under_regular_virtualenv():
# type: () -> bool
"""Check if "no-global-site-packages.txt" exists beside site.py
This mirrors logic in pypa/virtualenv for determining whether system
site-packages are visible in the virtual environment.
"""
site_mod_dir = os.path.dirname(os.path.abspath(site.__file__))
no_global_site_packages_file = os.path.join(
site_mod_dir, 'no-global-site-packages.txt',
)
return os.path.exists(no_global_site_packages_file)


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()

return False
return _no_global_under_venv()

0 comments on commit 6d69ce1

Please sign in to comment.