texinfo package: fix external detection (#40470)

A complete texinfo install includes both `info` and `makeinfo`. Some
system installations of texinfo may exclude one or the other. This
updates the external finding logic to require both.
This commit is contained in:
Dom Heinzeller 2023-10-13 11:39:08 -06:00 committed by GitHub
parent 8248e180ca
commit 02c680ec3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import re
from spack.package import *
@ -69,6 +70,13 @@ def setup_build_environment(self, env):
@classmethod
def determine_version(cls, exe):
# On CentOS and Ubuntu, the OS package info installs "info",
# which satisfies spack external find, but "makeinfo" comes
# from texinfo and may not be installed (and vice versa).
(texinfo_path, info_exe) = os.path.split(exe)
makeinfo_exe = os.path.join(texinfo_path, "makeinfo")
if not os.path.exists(makeinfo_exe):
return None
output = Executable(exe)("--version", output=str, error=str)
match = re.search(r"info \(GNU texinfo\)\s+(\S+)", output)
return match.group(1) if match else None