main, modules: fix module roots not being found (#24135)
Since the module roots were removed from the config file, `--print-shell-vars` cannot find the module roots anymore. Fix it by using the new `root_path` function. Moreover, the roots for lmod and modules seems to have been flipped by accident.
This commit is contained in:
parent
ff73ac6e9a
commit
7d3a3af621
@ -32,6 +32,7 @@
|
|||||||
import spack.config
|
import spack.config
|
||||||
import spack.cmd
|
import spack.cmd
|
||||||
import spack.environment as ev
|
import spack.environment as ev
|
||||||
|
import spack.modules
|
||||||
import spack.paths
|
import spack.paths
|
||||||
import spack.repo
|
import spack.repo
|
||||||
import spack.store
|
import spack.store
|
||||||
@ -647,14 +648,8 @@ def shell_set(var, value):
|
|||||||
'tcl': list(),
|
'tcl': list(),
|
||||||
'lmod': list()
|
'lmod': list()
|
||||||
}
|
}
|
||||||
module_roots = spack.config.get('modules:default:roots', {})
|
for name in module_to_roots.keys():
|
||||||
module_roots = spack.config.merge_yaml(
|
path = spack.modules.common.root_path(name, 'default')
|
||||||
module_roots, spack.config.get('config:module_roots', {}))
|
|
||||||
module_roots = dict(
|
|
||||||
(k, v) for k, v in module_roots.items() if k in module_to_roots
|
|
||||||
)
|
|
||||||
for name, path in module_roots.items():
|
|
||||||
path = spack.util.path.canonicalize_path(path)
|
|
||||||
module_to_roots[name].append(path)
|
module_to_roots[name].append(path)
|
||||||
|
|
||||||
other_spack_instances = spack.config.get(
|
other_spack_instances = spack.config.get(
|
||||||
|
@ -221,8 +221,8 @@ def root_path(name, module_set_name):
|
|||||||
root folder for module file installation
|
root folder for module file installation
|
||||||
"""
|
"""
|
||||||
defaults = {
|
defaults = {
|
||||||
'lmod': '$spack/share/spack/modules',
|
'lmod': '$spack/share/spack/lmod',
|
||||||
'tcl': '$spack/share/spack/lmod',
|
'tcl': '$spack/share/spack/modules',
|
||||||
}
|
}
|
||||||
# Root folders where the various module files should be written
|
# Root folders where the various module files should be written
|
||||||
roots = spack.config.get('modules:%s:roots' % module_set_name, {})
|
roots = spack.config.get('modules:%s:roots' % module_set_name, {})
|
||||||
|
Loading…
Reference in New Issue
Block a user