Skip to content

Commit 49abb75

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 97a0771 commit 49abb75

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

422422
def addsitepackages(known_paths, prefixes=None):
423423
"""Add site-packages to sys.path"""
424+
if os.environ.get("GENTOO_CPYTHON_BUILD") and prefixes is None: return known_paths
424425
_trace("Processing global site-packages")
425426
for sitedir in getsitepackages(prefixes):
426427
if os.path.isdir(sitedir):

0 commit comments

Comments
 (0)