bugfix: fix module() function in setup-env.sh (#12030)
Modify `setup-env.sh` to export fewer variables but to still set the module() function correctly.
This commit is contained in:
parent
ce88cc75ef
commit
3f47c5967d
@ -324,14 +324,17 @@ if [ "${need_module}" = "yes" ]; then
|
|||||||
if [ "${_sp_module_prefix}" != "not_installed" ]; then
|
if [ "${_sp_module_prefix}" != "not_installed" ]; then
|
||||||
# activate it!
|
# activate it!
|
||||||
# environment-modules@4: has a bin directory inside its prefix
|
# environment-modules@4: has a bin directory inside its prefix
|
||||||
MODULE_PREFIX_BIN="${_sp_module_prefix}/bin"
|
_sp_module_bin="${_sp_module_prefix}/bin"
|
||||||
if [ ! -d "${MODULE_PREFIX_BIN}" ]; then
|
if [ ! -d "${_sp_module_bin}" ]; then
|
||||||
# environment-modules@3 has a nested bin directory
|
# environment-modules@3 has a nested bin directory
|
||||||
MODULE_PREFIX_BIN="${_sp_module_prefix}/Modules/bin"
|
_sp_module_bin="${_sp_module_prefix}/Modules/bin"
|
||||||
fi
|
fi
|
||||||
export MODULE_PREFIX_BIN
|
|
||||||
_spack_pathadd PATH "${MODULE_PREFIX_BIN}"
|
# _sp_module_bin and _sp_shell are evaluated here; the quoted
|
||||||
module() { eval `${MODULE_PREFIX_BIN}/modulecmd ${_sp_shell} $*`; }
|
# eval statement and $* are deferred.
|
||||||
|
_sp_cmd="module() { eval \`${_sp_module_bin}/modulecmd ${_sp_shell} \$*\`; }"
|
||||||
|
eval "$_sp_cmd"
|
||||||
|
_spack_pathadd PATH "${_sp_module_bin}"
|
||||||
fi;
|
fi;
|
||||||
else
|
else
|
||||||
eval `spack --print-shell-vars sh`
|
eval `spack --print-shell-vars sh`
|
||||||
|
Loading…
Reference in New Issue
Block a user