diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2024-08-13 10:19:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-13 10:19:26 +0200 |
commit | 7001a2a65ac8643c05a986b03e821fe22ef196ff (patch) | |
tree | efd5eca42accab2355cefe8c86a6f6a8271bcf77 /var | |
parent | 7c985d643206f3df00c444a470a7785040006121 (diff) | |
download | spack-7001a2a65ac8643c05a986b03e821fe22ef196ff.tar.gz spack-7001a2a65ac8643c05a986b03e821fe22ef196ff.tar.bz2 spack-7001a2a65ac8643c05a986b03e821fe22ef196ff.tar.xz spack-7001a2a65ac8643c05a986b03e821fe22ef196ff.zip |
Fix a bug with automatic tag detection (#45696)
Extracted from #45638
When adding the "detectable" tag to a package class that has the
"tag" attribute inherited from a base class, we need to copy it to
avoid modifying the base class.
Diffstat (limited to 'var')
3 files changed, 40 insertions, 2 deletions
diff --git a/var/spack/repos/builtin.mock/packages/gcc/package.py b/var/spack/repos/builtin.mock/packages/gcc/package.py index 31f7c95b53..05518419dd 100644 --- a/var/spack/repos/builtin.mock/packages/gcc/package.py +++ b/var/spack/repos/builtin.mock/packages/gcc/package.py @@ -6,7 +6,7 @@ from spack.package import * -class Gcc(Package): +class Gcc(CompilerPackage, Package): """Simple compiler package.""" homepage = "http://www.example.com" @@ -18,6 +18,10 @@ class Gcc(Package): depends_on("conflict", when="@3.0") + c_names = ["gcc"] + cxx_names = ["g++"] + fortran_names = ["gfortran"] + def install(self, spec, prefix): # Create the minimal compiler that will fool `spack compiler find` mkdirp(prefix.bin) diff --git a/var/spack/repos/builtin.mock/packages/intel-oneapi-compilers/package.py b/var/spack/repos/builtin.mock/packages/intel-oneapi-compilers/package.py index f7c7dd67e5..78fdbe056c 100644 --- a/var/spack/repos/builtin.mock/packages/intel-oneapi-compilers/package.py +++ b/var/spack/repos/builtin.mock/packages/intel-oneapi-compilers/package.py @@ -8,7 +8,7 @@ import sys from spack.package import * -class IntelOneapiCompilers(Package): +class IntelOneapiCompilers(Package, CompilerPackage): """Simple compiler package.""" homepage = "http://www.example.com" @@ -18,6 +18,10 @@ class IntelOneapiCompilers(Package): version("2.0", md5="abcdef0123456789abcdef0123456789") version("3.0", md5="def0123456789abcdef0123456789abc") + c_names = ["icx"] + cxx_names = ["icpx"] + fortran_names = ["ifx"] + @property def compiler_search_prefix(self): return self.prefix.foo.bar.baz.bin diff --git a/var/spack/repos/builtin.mock/packages/llvm/package.py b/var/spack/repos/builtin.mock/packages/llvm/package.py new file mode 100644 index 0000000000..135ae5ebfa --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/llvm/package.py @@ -0,0 +1,30 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class Llvm(Package, CompilerPackage): + """Simple compiler package.""" + + homepage = "http://www.example.com" + url = "http://www.example.com/gcc-1.0.tar.gz" + + version("18.1.8", md5="0123456789abcdef0123456789abcdef") + + variant( + "clang", default=True, description="Build the LLVM C/C++/Objective-C compiler frontend" + ) + + c_names = ["clang"] + cxx_names = ["clang++"] + fortran_names = ["flang"] + + def install(self, spec, prefix): + # Create the minimal compiler that will fool `spack compiler find` + mkdirp(prefix.bin) + with open(prefix.bin.gcc, "w") as f: + f.write('#!/bin/bash\necho "%s"' % str(spec.version)) + set_executable(prefix.bin.gcc) |