sed: make package discoverable (#25481)

This commit is contained in:
Christoph Conrads 2021-08-20 14:31:31 +02:00 committed by GitHub
parent 201f5bdfe8
commit 8be614729c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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