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-08-01 14:51:38 +0200
commit07cf9fcbe952182643f9f82c59717286881ddb6f (patch)
treefbe07bcaff631f9aca811908f40f80ed06d824a7
parenttest_lzma: Skip tests requiring extra-filters (diff)
downloadcpython-gentoo-3.13.0rc1.tar.gz
cpython-gentoo-3.13.0rc1.tar.bz2
cpython-gentoo-3.13.0rc1.zip
Disable system site-packages via GENTOO_CPYTHON_BUILD vargentoo-3.13.0rc1
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 <mgorny@gentoo.org>
-rw-r--r--Lib/site.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/site.py b/Lib/site.py
index 0a0dc47b174..6ab0a31f679 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -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):