diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2024-08-21 16:36:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-21 16:36:07 +0200 |
commit | 33464a70383556663e42e9a036c7da06bf517490 (patch) | |
tree | afe5bdc6d47565d5ff1b647547abfe000be18dd2 | |
parent | d3cdb2a3447d148066355535fef4e81f6e8450db (diff) | |
download | spack-33464a70383556663e42e9a036c7da06bf517490.tar.gz spack-33464a70383556663e42e9a036c7da06bf517490.tar.bz2 spack-33464a70383556663e42e9a036c7da06bf517490.tar.xz spack-33464a70383556663e42e9a036c7da06bf517490.zip |
gcc: simplify version_regex, change string to filter out Apple clang (#45852)
-rw-r--r-- | var/spack/repos/builtin/packages/gcc/detection_test.yaml | 28 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/gcc/package.py | 4 |
2 files changed, 28 insertions, 4 deletions
diff --git a/var/spack/repos/builtin/packages/gcc/detection_test.yaml b/var/spack/repos/builtin/packages/gcc/detection_test.yaml index ced4af1590..c0195bb8ca 100644 --- a/var/spack/repos/builtin/packages/gcc/detection_test.yaml +++ b/var/spack/repos/builtin/packages/gcc/detection_test.yaml @@ -82,8 +82,7 @@ paths: if [ "$1" = "-dumpversion" ] ; then echo "9.3-win32" elif [ "$1" = "-dumpfullversion" ] ; then - echo "9.3-win32" >&2 - exit 1 + echo "9.3-win32" elif [ "$1" = "--version" ] ; then echo "i686-w64-mingw32-gcc (GCC) 9.3-win32 20200320" echo "Copyright (C) 2019 Free Software Foundation, Inc." @@ -95,3 +94,28 @@ paths: fi platforms: [linux] results: [] + +# Homebrew GCC should be detected +- layout: + - executables: + - "bin/gcc-14" + script: | + if [ "$1" = "-dumpversion" ] ; then + echo "14" + elif [ "$1" = "-dumpfullversion" ] ; then + echo "14.1.0" + elif [ "$1" = "--version" ] ; then + echo "gcc-14 (Homebrew GCC 14.1.0_2) 14.1.0" + echo "Copyright (C) 2024 Free Software Foundation, Inc." + echo "This is free software; see the source for copying conditions. There is NO" + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + else + echo "mock executable got an unexpected flag: $1" + exit 1 + fi + platforms: [darwin] + results: + - spec: "gcc@14.1.0 languages=c" + extra_attributes: + compilers: + c: ".*/bin/gcc-14$" diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index b4ca189159..ba0379bf37 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -536,7 +536,7 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage, CompilerPackage): d_names = ["gdc"] go_names = ["gccgo"] compiler_suffixes = [r"-mp-\d+(?:\.\d+)?", r"-\d+(?:\.\d+)?", r"\d\d"] - compiler_version_regex = r"(?<!clang version)\s?([0-9.]+)" + compiler_version_regex = r"([0-9.]+)" compiler_version_argument = ("-dumpfullversion", "-dumpversion") @classmethod @@ -549,7 +549,7 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage, CompilerPackage): output = spack.compiler.get_compiler_version_output(exe, "--version") except Exception: output = "" - if "Apple" in output: + if "clang version" in output: continue not_apple_clang.append(exe) return not_apple_clang |