Skip to content

Commit c3bad2a

Browse files
authored
gettext: find external (#28610)
1 parent dedf4a1 commit c3bad2a

File tree

1 file changed

+11
-0
lines changed
  • var/spack/repos/builtin/packages/gettext

1 file changed

+11
-0
lines changed

var/spack/repos/builtin/packages/gettext/package.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#
44
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
55

6+
import re
7+
68
from spack import *
79

810

@@ -12,6 +14,8 @@ class Gettext(AutotoolsPackage, GNUMirrorPackage):
1214
homepage = "https://www.gnu.org/software/gettext/"
1315
gnu_mirror_path = "gettext/gettext-0.20.1.tar.xz"
1416

17+
executables = [r'^gettext$']
18+
1519
version('0.21', sha256='d20fcbb537e02dcf1383197ba05bd0734ef7bf5db06bdb241eb69b7d16b73192')
1620
version('0.20.2', sha256='b22b818e644c37f6e3d1643a1943c32c3a9bff726d601e53047d2682019ceaba')
1721
version('0.20.1', sha256='53f02fbbec9e798b0faaf7c73272f83608e835c6288dd58be6c9bb54624a3800')
@@ -51,6 +55,13 @@ class Gettext(AutotoolsPackage, GNUMirrorPackage):
5155
patch('nvhpc-export-symbols.patch', when='%nvhpc')
5256
patch('nvhpc-long-width.patch', when='%nvhpc')
5357

58+
@classmethod
59+
def determine_version(cls, exe):
60+
gettext = Executable(exe)
61+
output = gettext('--version', output=str, error=str)
62+
match = re.match(r'gettext(?: \(.+\)) ([\d.]+)', output)
63+
return match.group(1) if match else None
64+
5465
def configure_args(self):
5566
spec = self.spec
5667

0 commit comments

Comments
 (0)