Skip to content

Commit fe1c7c0

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 b2d5d59 commit fe1c7c0

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
@@ -418,6 +418,7 @@ def getsitepackages(prefixes=None):
418418

419419
def addsitepackages(known_paths, prefixes=None):
420420
"""Add site-packages to sys.path"""
421+
if os.environ.get("GENTOO_CPYTHON_BUILD") and prefixes is None: return known_paths
421422
_trace("Processing global site-packages")
422423
for sitedir in getsitepackages(prefixes):
423424
if os.path.isdir(sitedir):

0 commit comments

Comments
 (0)