invalid compiler: warn instead of error (#43491)
This commit is contained in:
parent
8e0c659b51
commit
2077b3a006
1 changed files with 14 additions and 4 deletions
|
@ -10,6 +10,7 @@
|
||||||
import itertools
|
import itertools
|
||||||
import multiprocessing.pool
|
import multiprocessing.pool
|
||||||
import os
|
import os
|
||||||
|
import warnings
|
||||||
from typing import Dict, List, Optional, Tuple
|
from typing import Dict, List, Optional, Tuple
|
||||||
|
|
||||||
import archspec.cpu
|
import archspec.cpu
|
||||||
|
@ -341,7 +342,9 @@ def all_compilers_config(
|
||||||
from_compilers_yaml = get_compiler_config(configuration, scope=scope, init_config=init_config)
|
from_compilers_yaml = get_compiler_config(configuration, scope=scope, init_config=init_config)
|
||||||
|
|
||||||
result = from_compilers_yaml + from_packages_yaml
|
result = from_compilers_yaml + from_packages_yaml
|
||||||
key = lambda c: _compiler_from_config_entry(c["compiler"])
|
# Dedupe entries by the compiler they represent
|
||||||
|
# If the entry is invalid, treat it as unique for deduplication
|
||||||
|
key = lambda c: _compiler_from_config_entry(c["compiler"] or id(c))
|
||||||
return list(llnl.util.lang.dedupe(result, key=key))
|
return list(llnl.util.lang.dedupe(result, key=key))
|
||||||
|
|
||||||
|
|
||||||
|
@ -520,7 +523,9 @@ def all_compilers_from(configuration, scope=None, init_config=True):
|
||||||
configuration=configuration, scope=scope, init_config=init_config
|
configuration=configuration, scope=scope, init_config=init_config
|
||||||
):
|
):
|
||||||
items = items["compiler"]
|
items = items["compiler"]
|
||||||
compilers.append(_compiler_from_config_entry(items))
|
compiler = _compiler_from_config_entry(items) # can be None in error case
|
||||||
|
if compiler:
|
||||||
|
compilers.append(compiler)
|
||||||
return compilers
|
return compilers
|
||||||
|
|
||||||
|
|
||||||
|
@ -627,7 +632,10 @@ def _compiler_from_config_entry(items):
|
||||||
compiler = _compiler_cache.get(config_id, None)
|
compiler = _compiler_cache.get(config_id, None)
|
||||||
|
|
||||||
if compiler is None:
|
if compiler is None:
|
||||||
|
try:
|
||||||
compiler = compiler_from_dict(items)
|
compiler = compiler_from_dict(items)
|
||||||
|
except UnknownCompilerError as e:
|
||||||
|
warnings.warn(e.message)
|
||||||
_compiler_cache[config_id] = compiler
|
_compiler_cache[config_id] = compiler
|
||||||
|
|
||||||
return compiler
|
return compiler
|
||||||
|
@ -680,7 +688,9 @@ def get_compilers(config, cspec=None, arch_spec=None):
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
compilers.append(_compiler_from_config_entry(items))
|
compiler = _compiler_from_config_entry(items)
|
||||||
|
if compiler:
|
||||||
|
compilers.append(compiler)
|
||||||
|
|
||||||
return compilers
|
return compilers
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue