diff options
author | Michael Kuhn <michael.kuhn@ovgu.de> | 2021-06-05 00:33:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-04 15:33:18 -0700 |
commit | 7d3a3af621737cabd1e81eafc9b40d7159f769c5 (patch) | |
tree | b9b427a0915449dc9e06fcd210b070b904b5ab0d /lib | |
parent | ff73ac6e9a28297d08490538f187916fa61b938e (diff) | |
download | spack-7d3a3af621737cabd1e81eafc9b40d7159f769c5.tar.gz spack-7d3a3af621737cabd1e81eafc9b40d7159f769c5.tar.bz2 spack-7d3a3af621737cabd1e81eafc9b40d7159f769c5.tar.xz spack-7d3a3af621737cabd1e81eafc9b40d7159f769c5.zip |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/main.py | 11 | ||||
-rw-r--r-- | lib/spack/spack/modules/common.py | 4 |
2 files changed, 5 insertions, 10 deletions
diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index fa1406be14..18a95bb969 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -32,6 +32,7 @@ import spack.architecture import spack.config import spack.cmd import spack.environment as ev +import spack.modules import spack.paths import spack.repo import spack.store @@ -647,14 +648,8 @@ def print_setup_info(*info): 'tcl': list(), 'lmod': list() } - module_roots = spack.config.get('modules:default:roots', {}) - module_roots = spack.config.merge_yaml( - 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) + for name in module_to_roots.keys(): + path = spack.modules.common.root_path(name, 'default') module_to_roots[name].append(path) other_spack_instances = spack.config.get( diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py index ffd170226d..bb89487750 100644 --- a/lib/spack/spack/modules/common.py +++ b/lib/spack/spack/modules/common.py @@ -221,8 +221,8 @@ def root_path(name, module_set_name): root folder for module file installation """ defaults = { - 'lmod': '$spack/share/spack/modules', - 'tcl': '$spack/share/spack/lmod', + 'lmod': '$spack/share/spack/lmod', + 'tcl': '$spack/share/spack/modules', } # Root folders where the various module files should be written roots = spack.config.get('modules:%s:roots' % module_set_name, {}) |