diff options
-rw-r--r-- | lib/spack/spack/package.py | 21 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/fzf/package.py | 8 |
2 files changed, 17 insertions, 12 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) diff --git a/var/spack/repos/builtin/packages/fzf/package.py b/var/spack/repos/builtin/packages/fzf/package.py index 46303cb0d5..cee38abad4 100644 --- a/var/spack/repos/builtin/packages/fzf/package.py +++ b/var/spack/repos/builtin/packages/fzf/package.py @@ -2,12 +2,10 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - import os +import re import shutil -from spack import * - class Fzf(MakefilePackage): """fzf is a general-purpose command-line fuzzy finder.""" @@ -37,7 +35,9 @@ class Fzf(MakefilePackage): @classmethod def determine_version(cls, exe): - return Executable(exe)('--version', output=str, error=str).rstrip() + candidate = Executable(exe)('--version', output=str, error=str) + match = re.match(r'(^[\d.]+)', candidate) + return match.group(1) if match else None @when('@:0.17.5') def patch(self): |