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 12:51:28 +0200
commitdb384d1307b622803fff49c5c13098bd182d6ce2 (patch)
tree35310089bc1c177accc89d3286dff39c115900dc
parentgh-120602: Support LLVM_VERSION_SUFFIX (diff)
downloadcpython-db384d1307b622803fff49c5c13098bd182d6ce2.tar.gz
cpython-db384d1307b622803fff49c5c13098bd182d6ce2.tar.bz2
cpython-db384d1307b622803fff49c5c13098bd182d6ce2.zip
Disable system site-packages via GENTOO_CPYTHON_BUILD vargentoo-3.13.0b2_p8
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 7eace190f5..6fc50f2ed3 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_CPYTHON_BUILD") and prefixes is None: return known_paths
_trace("Processing global site-packages")
for sitedir in getsitepackages(prefixes):
if os.path.isdir(sitedir):