aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2024-06-18 11:20:36 +0200
committerMichał Górny <mgorny@gentoo.org>2024-06-18 11:20:36 +0200
commitf1177413e75218adc711ea68e10361a9d3448f0f (patch)
treef9fa2ba2cb40ca117bd9aaa4e6b36cf184844bb2
parentAdd missing textwrap import to datetimetester (diff)
downloadcpython-gentoo-3.13.0b2_p6.tar.gz
cpython-gentoo-3.13.0b2_p6.tar.bz2
cpython-gentoo-3.13.0b2_p6.zip
Support disabling system site-packages via GENTOO_BUILD vargentoo-3.13.0b2_p6
Do not add system site-packages directory to sys.path if GENTOO_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.
-rw-r--r--Lib/site.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/site.py b/Lib/site.py
index 7eace190f5a..68546f4069f 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -407,6 +407,7 @@ def getsitepackages(prefixes=None):
def addsitepackages(known_paths, prefixes=None):
"""Add site-packages to sys.path"""
+ if os.environ.get("GENTOO_BUILD") and prefixes is None: return known_paths
_trace("Processing global site-packages")
for sitedir in getsitepackages(prefixes):
if os.path.isdir(sitedir):