Python: do not set PYTHONHOME during build (#33956)

Setting PYTHONHOME is rarely needed (since each interpreter has
various ways of setting it automatically) and very often it is
difficult to get right manually.

For instance, the change done to set PYTHONHOME to
sysconfig["base_prefix"] broke bootstrapping dev dependencies
of Spack for me, when working inside a virtual environment in Linux.
This commit is contained in:
Massimiliano Culpo 2022-11-17 15:41:50 +01:00 committed by GitHub
parent 294e6f80a0
commit 4a71020cd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1424,12 +1424,7 @@ def setup_dependent_build_environment(self, env, dependent_spec):
"""Set PYTHONPATH to include the site-packages directory for the
extension and any other python extensions it depends on.
"""
# If we set PYTHONHOME, we must also ensure that the corresponding
# python is found in the build environment. This to prevent cases
# where a system provided python is run against the standard libraries
# of a Spack built python. See issue #7128
env.set("PYTHONHOME", self.home)
# Ensure the current Python is first in the PATH
path = os.path.dirname(self.command.path)
if not is_system_path(path):
env.prepend_path("PATH", path)