summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-12-08 22:58:21 +0100
committerGitHub <noreply@github.com>2021-12-08 13:58:21 -0800
commit01d077d4bc3aac21b2f8f83f6fa7071ea18418e5 (patch)
tree306c99862a0e4f92bf8cf452aa24200ba6fd1ae9 /lib
parent79a04605d3cef746cc21ee1146c8c654b6de0d9d (diff)
downloadspack-01d077d4bc3aac21b2f8f83f6fa7071ea18418e5.tar.gz
spack-01d077d4bc3aac21b2f8f83f6fa7071ea18418e5.tar.bz2
spack-01d077d4bc3aac21b2f8f83f6fa7071ea18418e5.tar.xz
spack-01d077d4bc3aac21b2f8f83f6fa7071ea18418e5.zip
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/detection/path.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/spack/spack/detection/path.py b/lib/spack/spack/detection/path.py
index 0e652ed6c2..66998e4b0b 100644
--- a/lib/spack/spack/detection/path.py
+++ b/lib/spack/spack/detection/path.py
@@ -9,6 +9,7 @@ import collections
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(