summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <gamblin2@llnl.gov>2021-05-22 15:35:07 -0700
committerGitHub <noreply@github.com>2021-05-22 15:35:07 -0700
commitd45674c1cbb726e1ad625f32d873ef79da92e90d (patch)
tree14b3eef498e14808ebb5781d151e8e1cd9e23fc3
parent17473a08fffc3699383dd22f46cb6e5dce81eea9 (diff)
downloadspack-d45674c1cbb726e1ad625f32d873ef79da92e90d.tar.gz
spack-d45674c1cbb726e1ad625f32d873ef79da92e90d.tar.bz2
spack-d45674c1cbb726e1ad625f32d873ef79da92e90d.tar.xz
spack-d45674c1cbb726e1ad625f32d873ef79da92e90d.zip
Spack can Use RHEL8's `platform-python` if nothing else is available. (#23857)
This adds RHEL8's `/usr/libexec/platform-python` to Spack's list of preferred pythons. It will only be used if no other `python` is available in the `PATH`. We have been testing with this python for a while now, and it seems to do all that we need. If Spack one day isn't able to work with it, we'll take it out, but for now it is useful to allow Spack to be used on RHEL8 without a dedicated `python` installation.
-rw-r--r--.github/workflows/unit_tests.yaml2
-rwxr-xr-xbin/spack3
2 files changed, 2 insertions, 3 deletions
diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml
index e45e1aad1b..804d7fa125 100644
--- a/.github/workflows/unit_tests.yaml
+++ b/.github/workflows/unit_tests.yaml
@@ -283,8 +283,6 @@ jobs:
useradd spack-test
chown -R spack-test .
- name: Run unit tests
- env:
- SPACK_PYTHON: /usr/libexec/platform-python
shell: runuser -u spack-test -- bash {0}
run: |
source share/spack/setup-env.sh
diff --git a/bin/spack b/bin/spack
index 14fd037c1e..a4c442227d 100755
--- a/bin/spack
+++ b/bin/spack
@@ -11,7 +11,8 @@
# See https://stackoverflow.com/a/47886254
""":"
# prefer SPACK_PYTHON environment variable, python3, python, then python2
-for cmd in "${SPACK_PYTHON:-}" python3 python python2; do
+SPACK_PREFERRED_PYTHONS="python3 python python2 /usr/libexec/platform-python"
+for cmd in "${SPACK_PYTHON:-}" ${SPACK_PREFERRED_PYTHONS}; do
if command -v > /dev/null "$cmd"; then
export SPACK_PYTHON="$(command -v "$cmd")"
exec "${SPACK_PYTHON}" "$0" "$@"