Compare commits
4 Commits
develop
...
bugfix/inv
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c899dcac5b | ||
![]() |
94dc25ecfa | ||
![]() |
aded859856 | ||
![]() |
2e3fc288ae |
@@ -156,7 +156,15 @@ def get_compiler_config_from_packages(
|
||||
def _compiler_config_from_package_config(config):
|
||||
compilers = []
|
||||
for entry in config:
|
||||
compiler = _compiler_config_from_external(entry)
|
||||
try:
|
||||
compiler = _compiler_config_from_external(entry)
|
||||
except Exception as e:
|
||||
msg = "Reading compiler from packages config section failed\n"
|
||||
msg += f" Compiler: {entry.get('spec', None)}\n"
|
||||
msg += f" Prefix: {entry.get('prefix', None)}\n"
|
||||
msg += f" Failure: {e}"
|
||||
warnings.warn(msg)
|
||||
compiler = None
|
||||
if compiler:
|
||||
compilers.append(compiler)
|
||||
|
||||
|
@@ -1492,3 +1492,26 @@ def test_config_path_dsl(path, it_should_work, expected_parsed):
|
||||
else:
|
||||
with pytest.raises(ValueError):
|
||||
spack.config.ConfigPath._validate(path)
|
||||
|
||||
|
||||
def test_compiler_parsing_errors(tmpdir):
|
||||
content = """\
|
||||
packages:
|
||||
gcc:
|
||||
externals:
|
||||
- spec: gcc@8.5.0 languages='c,c++,fortran'
|
||||
prefix: /usr
|
||||
extra_attributes:
|
||||
compilers:
|
||||
c: /usr/bin/gcc
|
||||
cxx: /usr/bin/g++
|
||||
fortran: /usr/bin/gfortran
|
||||
"""
|
||||
|
||||
testscope = join_path(tmpdir.strpath, "packages.yaml")
|
||||
with open(testscope, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
with spack.config.use_configuration(tmpdir.strpath):
|
||||
compilers = spack.compilers.get_compiler_config_from_packages(spack.config.CONFIG)
|
||||
assert spack.spec.Spec(compilers[0]["compiler"]["spec"]).satisfies("gcc@8.5.0")
|
||||
|
Reference in New Issue
Block a user