summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorMichael Kuhn <suraia@ikkoku.de>2019-02-28 13:22:44 +0100
committerMassimiliano Culpo <massimiliano.culpo@gmail.com>2019-02-28 13:22:44 +0100
commit617c1a37060b975d12f8bfa4bdfd0acb0fa8a2d0 (patch)
tree4ef2b6f0c616694dd4ea745adc94a3cc6c61e807 /share
parent4e809775067c2483aee59b5d4e13b579be4ae2b2 (diff)
downloadspack-617c1a37060b975d12f8bfa4bdfd0acb0fa8a2d0.tar.gz
spack-617c1a37060b975d12f8bfa4bdfd0acb0fa8a2d0.tar.bz2
spack-617c1a37060b975d12f8bfa4bdfd0acb0fa8a2d0.tar.xz
spack-617c1a37060b975d12f8bfa4bdfd0acb0fa8a2d0.zip
Fix shell integration with environment-modules@4 (#10736)
Diffstat (limited to 'share')
-rwxr-xr-xshare/spack/setup-env.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index f82a55d8f1..19bb3e24e8 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -272,10 +272,16 @@ if [ "${need_module}" = "yes" ]; then
# _sp_module_prefix is set by spack --print-sh-vars
if [ "${_sp_module_prefix}" != "not_installed" ]; then
- #activate it!
- export MODULE_PREFIX=${_sp_module_prefix}
- _spack_pathadd PATH "${MODULE_PREFIX}/Modules/bin"
- module() { eval `${MODULE_PREFIX}/Modules/bin/modulecmd ${SPACK_SHELL} $*`; }
+ # activate it!
+ # environment-modules@4: has a bin directory inside its prefix
+ MODULE_PREFIX_BIN="${_sp_module_prefix}/bin"
+ if [ ! -d "${MODULE_PREFIX_BIN}" ]; then
+ # environment-modules@3 has a nested bin directory
+ MODULE_PREFIX_BIN="${_sp_module_prefix}/Modules/bin"
+ fi
+ export MODULE_PREFIX_BIN
+ _spack_pathadd PATH "${MODULE_PREFIX_BIN}"
+ module() { eval `${MODULE_PREFIX_BIN}/modulecmd ${SPACK_SHELL} $*`; }
fi;
else
eval `spack --print-shell-vars sh`