R: external detection (#46023)

Co-authored-by: wdconinc <wdconinc@users.noreply.github.com>
This commit is contained in:
Wouter Deconinck 2024-08-26 06:37:35 -05:00 committed by GitHub
parent a8e25193e0
commit a5436b3962
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,6 +20,8 @@ class R(AutotoolsPackage):
extendable = True extendable = True
executables = ["^R$"]
license("GPL-2.0-or-later") license("GPL-2.0-or-later")
version("4.4.1", sha256="b4cb675deaaeb7299d3b265d218cde43f192951ce5b89b7bb1a5148a36b2d94d") version("4.4.1", sha256="b4cb675deaaeb7299d3b265d218cde43f192951ce5b89b7bb1a5148a36b2d94d")
@ -127,6 +129,24 @@ class R(AutotoolsPackage):
build_directory = "spack-build" build_directory = "spack-build"
@classmethod
def determine_version(cls, exe):
output = Executable(exe)("--version", output=str, error=str)
# R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
match = re.search(r"^R version ([^\s]+)", output)
return match.group(1) if match else None
@classmethod
def determine_variants(cls, exes, version):
variants = []
for exe in exes:
output = Executable(exe)("CMD", "config", "--all", output=str, error=str)
if "-lX11" in output:
variants.append("+X")
return variants
# R custom URL version # R custom URL version
def url_for_version(self, version): def url_for_version(self, version):
"""Handle R's customed URL versions""" """Handle R's customed URL versions"""