Make external detection more resilient to individual package errors (#27854)
After this PR an error in a single package while detecting external software won't abort the entire procedure. The error is reported to screen as a warning.
This commit is contained in:
parent
79a04605d3
commit
01d077d4bc
@ -9,6 +9,7 @@
|
|||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
|
import warnings
|
||||||
|
|
||||||
import llnl.util.filesystem
|
import llnl.util.filesystem
|
||||||
import llnl.util.tty
|
import llnl.util.tty
|
||||||
@ -99,9 +100,14 @@ def by_executable(packages_to_check, path_hints=None):
|
|||||||
# for one prefix, but without additional details (e.g. about the
|
# for one prefix, but without additional details (e.g. about the
|
||||||
# naming scheme which differentiates them), the spec won't be
|
# naming scheme which differentiates them), the spec won't be
|
||||||
# usable.
|
# usable.
|
||||||
|
try:
|
||||||
specs = _convert_to_iterable(
|
specs = _convert_to_iterable(
|
||||||
pkg.determine_spec_details(prefix, exes_in_prefix)
|
pkg.determine_spec_details(prefix, exes_in_prefix)
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
specs = []
|
||||||
|
msg = 'error detecting "{0}" from prefix {1} [{2}]'
|
||||||
|
warnings.warn(msg.format(pkg.name, prefix, str(e)))
|
||||||
|
|
||||||
if not specs:
|
if not specs:
|
||||||
llnl.util.tty.debug(
|
llnl.util.tty.debug(
|
||||||
|
Loading…
Reference in New Issue
Block a user