From e1276d4a0359aa824597ca75ac2c73158a906810 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 16 Dec 2024 05:52:35 -0700 Subject: [PATCH] Fix style for finding external grep --- var/spack/repos/builtin/packages/grep/package.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/grep/package.py b/var/spack/repos/builtin/packages/grep/package.py index 76f0b5f07061b1..40bd0deddb01b5 100644 --- a/var/spack/repos/builtin/packages/grep/package.py +++ b/var/spack/repos/builtin/packages/grep/package.py @@ -35,12 +35,16 @@ class Grep(AutotoolsPackage): @classmethod def determine_version(cls, exe): version_string = Executable(exe)("--version", output=str, error=str).split('\n')[0] + # Linux if "GNU grep" in version_string: return version_string.lstrip("grep (GNU grep)").strip() + # macOS elif "BSD grep, GNU compatible" in version_string: - return version_string.lstrip("grep (BSD grep, GNU compatible)").rstrip("-FreeBSD").strip() + return ( + version_string.lstrip("grep (BSD grep, GNU compatible)").rstrip("-FreeBSD").strip() + ) + # Don't know how to handle this version of grep, don't add it else: - # Don't know how to handle this version of grep, don't add it return None def configure_args(self):