From 01d077d4bc3aac21b2f8f83f6fa7071ea18418e5 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Wed, 8 Dec 2021 22:58:21 +0100 Subject: 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. --- lib/spack/spack/detection/path.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib') 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( -- cgit v1.2.3-60-g2f50