swig: support external find (#31990)

This commit is contained in:
Olivier Cessenat 2022-08-08 19:41:41 +02:00 committed by GitHub
parent b24a068f3d
commit 1d4925387e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import re
from spack.package import *
@ -22,7 +23,9 @@ class Swig(AutotoolsPackage, SourceforgePackage):
sourceforge_mirror_path = "swig/swig-3.0.12.tar.gz"
maintainers = ["sethrj"]
tags = ["e4s"]
tags = ["e4s", "build-tools"]
executables = ["^swig$"]
version("master", git="https://github.com/swig/swig.git")
version(
@ -66,6 +69,12 @@ class Swig(AutotoolsPackage, SourceforgePackage):
conflicts("%nvhpc", when="@:4.0.2")
@classmethod
def determine_version(cls, exe):
output = Executable(exe)("-version", output=str, error=str)
match = re.search(r"SWIG\s+Version\s+(\S+)", output)
return match.group(1) if match else None
@run_after("install")
def create_symlink(self):
# CMake compatibility: see https://github.com/spack/spack/pull/6240