Fix shell integration with environment-modules@4 (#10736)
This commit is contained in:
parent
4e80977506
commit
617c1a3706
@ -46,7 +46,7 @@ def bootstrap(parser, args, **kwargs):
|
|||||||
# Define requirement dictionary defining general specs which need
|
# Define requirement dictionary defining general specs which need
|
||||||
# to be satisfied, and the specs to install when the general spec
|
# to be satisfied, and the specs to install when the general spec
|
||||||
# isn't satisfied.
|
# isn't satisfied.
|
||||||
requirement_dict = {'environment-modules': 'environment-modules@3.2.10~X'}
|
requirement_dict = {'environment-modules': 'environment-modules~X'}
|
||||||
|
|
||||||
for requirement in requirement_dict:
|
for requirement in requirement_dict:
|
||||||
installed_specs = spack.store.db.query(requirement)
|
installed_specs = spack.store.db.query(requirement)
|
||||||
|
@ -273,9 +273,15 @@ if [ "${need_module}" = "yes" ]; then
|
|||||||
# _sp_module_prefix is set by spack --print-sh-vars
|
# _sp_module_prefix is set by spack --print-sh-vars
|
||||||
if [ "${_sp_module_prefix}" != "not_installed" ]; then
|
if [ "${_sp_module_prefix}" != "not_installed" ]; then
|
||||||
# activate it!
|
# activate it!
|
||||||
export MODULE_PREFIX=${_sp_module_prefix}
|
# environment-modules@4: has a bin directory inside its prefix
|
||||||
_spack_pathadd PATH "${MODULE_PREFIX}/Modules/bin"
|
MODULE_PREFIX_BIN="${_sp_module_prefix}/bin"
|
||||||
module() { eval `${MODULE_PREFIX}/Modules/bin/modulecmd ${SPACK_SHELL} $*`; }
|
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;
|
fi;
|
||||||
else
|
else
|
||||||
eval `spack --print-shell-vars sh`
|
eval `spack --print-shell-vars sh`
|
||||||
|
Loading…
Reference in New Issue
Block a user