diff options
author | Harmen Stoppels <harmenstoppels@gmail.com> | 2023-10-04 21:38:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-04 14:38:50 -0500 |
commit | 0f43074f3e93d13445ea662a13f5672f960947c2 (patch) | |
tree | e446625fd9abec7a61ac4d736bfa122c6920bbb9 /bin/sbang | |
parent | d297098504e80715e612695bd19c77f605b94f3f (diff) | |
download | spack-0f43074f3e93d13445ea662a13f5672f960947c2.tar.gz spack-0f43074f3e93d13445ea662a13f5672f960947c2.tar.bz2 spack-0f43074f3e93d13445ea662a13f5672f960947c2.tar.xz spack-0f43074f3e93d13445ea662a13f5672f960947c2.zip |
Improve build isolation in PythonPipBuilder (#40224)
We run pip with `--no-build-isolation` because we don't wanna let pip
install build deps.
As a consequence, when pip runs hooks, it runs hooks of *any* package it
can find in `sys.path`.
For Spack-built Python this includes user site packages -- there
shouldn't be any system site packages. So in this case it suffices to
set the environment variable PYTHONNOUSERSITE=1.
For external Python, more needs to be done, cause there is no env
variable that disables both system and user site packages; setting the
`python -S` flag doesn't work because pip runs subprocesses that don't
inherit this flag (and there is no API to know if -S was passed)
So, for external Python, an empty venv is created before invoking pip in
Spack's build env ensures that pip can no longer see anything but
standard libraries and `PYTHONPATH`.
The downside of this is that pip will generate shebangs that point to
the python executable from the venv. So, for external python an extra
step is necessary where we fix up shebangs post install.
Diffstat (limited to 'bin/sbang')
0 files changed, 0 insertions, 0 deletions