From 4bedae3d3a8c283606f34daa7494b38ee3b7c027 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Mon, 18 Nov 2024 19:02:24 +0100 Subject: [PATCH] fix: a compiler package sets dependent build environment only if used as such --- lib/spack/spack/build_systems/compiler.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/spack/spack/build_systems/compiler.py b/lib/spack/spack/build_systems/compiler.py index ba15e57b469..712778e0e1f 100644 --- a/lib/spack/spack/build_systems/compiler.py +++ b/lib/spack/spack/build_systems/compiler.py @@ -194,6 +194,13 @@ def enable_new_dtags(self) -> str: def setup_dependent_build_environment(self, env, dependent_spec): # FIXME (compiler as nodes): check if this is good enough or should be made more general + # The package is not used as a compiler, so skip this setup + if not any( + lang in dependent_spec and dependent_spec[lang].name == self.spec.name + for lang in ("c", "cxx", "fortran") + ): + return + # Populate an object with the list of environment modifications and return it link_dir = pathlib.Path(spack.paths.build_env_path)