Skip to content

Commit 6d343d4

Browse files
committed
Disable system site-packages via GENTOO_CPYTHON_BUILD var
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]>
1 parent 9cd7413 commit 6d343d4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Lib/site.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ def getsitepackages(prefixes=None):
415415

416416
def addsitepackages(known_paths, prefixes=None):
417417
"""Add site-packages to sys.path"""
418+
if os.environ.get("GENTOO_CPYTHON_BUILD") and prefixes is None: return known_paths
418419
_trace("Processing global site-packages")
419420
for sitedir in getsitepackages(prefixes):
420421
if os.path.isdir(sitedir):

0 commit comments

Comments
 (0)