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:
Massimiliano Culpo 2021-12-08 22:58:21 +01:00 committed by GitHub
parent 79a04605d3
commit 01d077d4bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@
import os
import os.path
import re
import warnings
import llnl.util.filesystem
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
# naming scheme which differentiates them), the spec won't be
# usable.
specs = _convert_to_iterable(
pkg.determine_spec_details(prefix, exes_in_prefix)
)
try:
specs = _convert_to_iterable(
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:
llnl.util.tty.debug(