summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2019-10-05 08:42:21 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2019-10-04 23:42:21 -0700
commit6a1021b81cb3e0de3510c5d0b410d49055d73f0e (patch)
treeb6742400259d38750ba75d25875265e7e9a78b0a
parenta362cf5ff6dcea353560409b9430ca82150b5918 (diff)
downloadspack-6a1021b81cb3e0de3510c5d0b410d49055d73f0e.tar.gz
spack-6a1021b81cb3e0de3510c5d0b410d49055d73f0e.tar.bz2
spack-6a1021b81cb3e0de3510c5d0b410d49055d73f0e.tar.xz
spack-6a1021b81cb3e0de3510c5d0b410d49055d73f0e.zip
bugfix: issue with custom dotkit root in config.yaml (#13046)
When removing support for dotkit in #11986 the code trying to set the paths of the various module files was not updated to skip it. This results in a failure because of a key error after the deprecation warning is displayed to user. This commit fixes the issue and adds a unit test for regression. Note that code for Spack chains has been updated accordingly but no unit test has been added for that case.
-rw-r--r--lib/spack/spack/main.py9
-rw-r--r--lib/spack/spack/test/config.py17
2 files changed, 25 insertions, 1 deletions
diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py
index 0984aa3b00..89b4d3dc85 100644
--- a/lib/spack/spack/main.py
+++ b/lib/spack/spack/main.py
@@ -588,11 +588,14 @@ def print_setup_info(*info):
shell_set('_sp_compatible_sys_types',
':'.join(spack.architecture.compatible_sys_types()))
# print roots for all module systems
- module_roots = spack.config.get('config:module_roots')
module_to_roots = {
'tcl': list(),
'lmod': list()
}
+ 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)
@@ -601,6 +604,10 @@ def print_setup_info(*info):
'upstreams') or {}
for install_properties in other_spack_instances.values():
upstream_module_roots = install_properties.get('modules', {})
+ upstream_module_roots = dict(
+ (k, v) for k, v in upstream_module_roots.items()
+ if k in module_to_roots
+ )
for module_type, root in upstream_module_roots.items():
module_to_roots[module_type].append(root)
diff --git a/lib/spack/spack/test/config.py b/lib/spack/spack/test/config.py
index cf0de70856..631fbabe8b 100644
--- a/lib/spack/spack/test/config.py
+++ b/lib/spack/spack/test/config.py
@@ -16,6 +16,7 @@ import ruamel.yaml as yaml
import spack.paths
import spack.config
+import spack.main
import spack.schema.compilers
import spack.schema.config
import spack.schema.env
@@ -759,3 +760,19 @@ compilers:
- compiler:
fenfironfent: /bad/value
""")
+
+
+@pytest.mark.regression('13045')
+def test_dotkit_in_config_does_not_raise(
+ mock_config, write_config_file, capsys
+):
+ write_config_file('config',
+ {'config': {'module_roots': {'dotkit': '/some/path'}}},
+ 'high')
+ spack.main.print_setup_info('sh')
+ captured = capsys.readouterr()
+
+ # Check that we set the variables we expect and that
+ # we throw a a deprecation warning without raising
+ assert '_sp_sys_type' in captured[0] # stdout
+ assert 'Warning' in captured[1] # stderr