From 7d3a3af621737cabd1e81eafc9b40d7159f769c5 Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Sat, 5 Jun 2021 00:33:18 +0200 Subject: 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. --- lib/spack/spack/main.py | 11 +++-------- lib/spack/spack/modules/common.py | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'lib') 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, {}) -- cgit v1.2.3-70-g09d2