summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/sed/package.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/sed/package.py b/var/spack/repos/builtin/packages/sed/package.py
index 98ac82b36f..7ad00ea65e 100644
--- a/var/spack/repos/builtin/packages/sed/package.py
+++ b/var/spack/repos/builtin/packages/sed/package.py
@@ -3,6 +3,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import re
+
from spack import *
@@ -12,3 +14,12 @@ class Sed(AutotoolsPackage, GNUMirrorPackage):
gnu_mirror_path = "sed/sed-4.2.2.tar.bz2"
version('4.2.2', sha256='f048d1838da284c8bc9753e4506b85a1e0cc1ea8999d36f6995bcb9460cddbd7')
+
+ executables = ['^sed$']
+
+ @classmethod
+ def determine_version(cls, exe):
+ output = Executable(exe)('--version', output=str, error=str)
+ version_regexp = r'{:s} \(GNU sed\) (\S+)'.format(exe)
+ match = re.search(version_regexp, output)
+ return match.group(1) if match else None