Skip to content

Commit 6d105e4

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 <mgorny@gentoo.org>
1 parent 95ae867 commit 6d105e4

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Lib/site.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ def addsitepackages(self, prefixes=None):
323323
global PREFIXES when *prefixes* is None. Each directory's startup
324324
data is accumulated for later processing by process().
325325
"""
326+
if os.environ.get("GENTOO_CPYTHON_BUILD") and prefixes is None: return
326327
_trace("Processing global site-packages")
327328
for sitedir in getsitepackages(prefixes):
328329
if os.path.isdir(sitedir):

0 commit comments

Comments
 (0)