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>
This commit is contained in:
Massimiliano Culpo
2020-10-21 21:35:02 +02:00
committed by GitHub
parent 2bb775496e
commit c696518efd
2 changed files with 17 additions and 12 deletions

View File

@@ -202,14 +202,19 @@ def determine_spec_details(cls, prefix, exes_in_prefix):
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)