summaryrefslogtreecommitdiff
path: root/share/spack/setup-env.fish
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.fish
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.fish')
-rwxr-xr-xshare/spack/setup-env.fish15
1 files changed, 14 insertions, 1 deletions
diff --git a/share/spack/setup-env.fish b/share/spack/setup-env.fish
index 15eff90dd2..190934531d 100755
--- a/share/spack/setup-env.fish
+++ b/share/spack/setup-env.fish
@@ -253,7 +253,7 @@ function match_flag -d "checks all combinations of flags ocurring inside of a st
set -l _a (string sub -s 2 (string trim "x$argv[1]"))
set -l _b (string sub -s 2 (string trim "x$argv[2]"))
- if test -z "$_a" || test -z "$_b"
+ if test -z "$_a" or test -z "$_b"
return 0
end
@@ -668,6 +668,19 @@ set -l sp_source_file (status -f) # name of current file
#
+# Identify and lock the python interpreter
+#
+for cmd in "$SPACK_PYTHON" python3 python python2
+ set -l _sp_python (command -s "$cmd")
+ if test $status -eq 0
+ set -x SPACK_PYTHON $_sp_python
+ break
+ end
+end
+
+
+
+#
# Find root directory and add bin to path.
#
set -l sp_share_dir (realpath (dirname $sp_source_file))