diff --git a/var/spack/repos/builtin/packages/gettext/package.py b/var/spack/repos/builtin/packages/gettext/package.py index ab4e2e74ec..9f3025d1bc 100644 --- a/var/spack/repos/builtin/packages/gettext/package.py +++ b/var/spack/repos/builtin/packages/gettext/package.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import re + from spack import * @@ -12,6 +14,8 @@ class Gettext(AutotoolsPackage, GNUMirrorPackage): homepage = "https://www.gnu.org/software/gettext/" gnu_mirror_path = "gettext/gettext-0.20.1.tar.xz" + executables = [r'^gettext$'] + version('0.21', sha256='d20fcbb537e02dcf1383197ba05bd0734ef7bf5db06bdb241eb69b7d16b73192') version('0.20.2', sha256='b22b818e644c37f6e3d1643a1943c32c3a9bff726d601e53047d2682019ceaba') version('0.20.1', sha256='53f02fbbec9e798b0faaf7c73272f83608e835c6288dd58be6c9bb54624a3800') @@ -51,6 +55,13 @@ class Gettext(AutotoolsPackage, GNUMirrorPackage): patch('nvhpc-export-symbols.patch', when='%nvhpc') patch('nvhpc-long-width.patch', when='%nvhpc') + @classmethod + def determine_version(cls, exe): + gettext = Executable(exe) + output = gettext('--version', output=str, error=str) + match = re.match(r'gettext(?: \(.+\)) ([\d.]+)', output) + return match.group(1) if match else None + def configure_args(self): spec = self.spec