summaryrefslogtreecommitdiff
path: root/share/spack/setup-env.sh
diff options
context:
space:
mode:
authorChuck Atkins <chuck.atkins@kitware.com>2021-02-12 13:52:44 -0500
committerGitHub <noreply@github.com>2021-02-12 10:52:44 -0800
commit5a771bc8ad3ddb1b3f550f1685c451cc6cb49e64 (patch)
tree67216810f4f0f0d94d805110f1ffe4e5fb757a99 /share/spack/setup-env.sh
parent7add9de2e531e7a498cff85c20ff474d6d4eddec (diff)
downloadspack-5a771bc8ad3ddb1b3f550f1685c451cc6cb49e64.tar.gz
spack-5a771bc8ad3ddb1b3f550f1685c451cc6cb49e64.tar.bz2
spack-5a771bc8ad3ddb1b3f550f1685c451cc6cb49e64.tar.xz
spack-5a771bc8ad3ddb1b3f550f1685c451cc6cb49e64.zip
Introduce a SPACK_PYTHON environment variable (#21222)
The SPACK_PYTHON environment variable can be set to a python interpreter to be used by the spack command. This allows the spack command itself to use a consistent and separate interpreter from whatever python might be used for package building.
Diffstat (limited to 'share/spack/setup-env.sh')
-rwxr-xr-xshare/spack/setup-env.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index c4c7af4b0a..cbee4428d0 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -326,6 +326,14 @@ if [ "$_sp_shell" = bash ]; then
export -f _spack_shell_wrapper
fi
+# Identify and lock the python interpreter
+for cmd in "${SPACK_PYTHON:-}" python3 python python2; do
+ if command -v > /dev/null "$cmd"; then
+ export SPACK_PYTHON="$(command -v "$cmd")"
+ break
+ fi
+done
+
#
# make available environment-modules
#