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):