Skip to content

Commit

Permalink
Disable system site-packages via GENTOO_CPYTHON_BUILD var
Browse files Browse the repository at this point in the history
Do not add system site-packages directory to sys.path
if GENTOO_CPYTHON_BUILD variable is set.  This solves multiple issues
while building and testing CPython, particularly test suite issues from
installed .pth files, Python modules (particularly docutils) and sandbox
violations from attempting to write byte-compiled modules back.

Signed-off-by: Michał Górny <[email protected]>
  • Loading branch information
mgorny committed Aug 1, 2024
1 parent 6cb2c9c commit 07cf9fc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Lib/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ def getsitepackages(prefixes=None):

def addsitepackages(known_paths, prefixes=None):
"""Add site-packages to sys.path"""
if os.environ.get("GENTOO_CPYTHON_BUILD") and prefixes is None: return known_paths
_trace("Processing global site-packages")
for sitedir in getsitepackages(prefixes):
if os.path.isdir(sitedir):
Expand Down

0 comments on commit 07cf9fc

Please sign in to comment.