diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2020-10-21 21:35:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-21 21:35:02 +0200 |
commit | c696518efda3ae5087d90325381f8e315b660add (patch) | |
tree | f287e319458810ef2ea74d972867cef20c6262f6 /lib | |
parent | 2bb775496ed0ecddee1eb5b55d149f25a33fd8a2 (diff) | |
download | spack-c696518efda3ae5087d90325381f8e315b660add.tar.gz spack-c696518efda3ae5087d90325381f8e315b660add.tar.bz2 spack-c696518efda3ae5087d90325381f8e315b660add.tar.xz spack-c696518efda3ae5087d90325381f8e315b660add.zip |
Skip malformed spec strings when searching for externals (#19438)
fixes #19266
fzf search method has also been updated
Co-authored-by: Tom Scogland <tom.scogland@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/package.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 14b1d1089a..a4e91fc186 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -202,14 +202,19 @@ class DetectablePackageMeta(object): external_modules = extra_attributes.pop( 'modules', None ) - spec = spack.spec.Spec( - spec_str, - external_path=external_path, - external_modules=external_modules - ) - specs.append(spack.spec.Spec.from_detection( - spec, extra_attributes=extra_attributes - )) + try: + spec = spack.spec.Spec( + spec_str, + external_path=external_path, + external_modules=external_modules + ) + except Exception as e: + msg = 'Parsing failed [spec_str="{0}", error={1}]' + tty.debug(msg.format(spec_str, str(e))) + else: + specs.append(spack.spec.Spec.from_detection( + spec, extra_attributes=extra_attributes + )) return sorted(specs) |