From bec6b06c16892f4330cea7f185416bbd88ab4b81 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 12 Nov 2024 09:20:15 +0100 Subject: [PATCH] Spec.__contains__: traverse only lin/run + direct build --- lib/spack/spack/modules/lmod.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/spack/spack/modules/lmod.py b/lib/spack/spack/modules/lmod.py index 643f547905f..d18a4dedbaf 100644 --- a/lib/spack/spack/modules/lmod.py +++ b/lib/spack/spack/modules/lmod.py @@ -97,14 +97,16 @@ class LmodConfiguration(BaseConfiguration): default_projections = {"all": "{name}/{version}"} + compiler: Optional[spack.spec.Spec] + def __init__(self, spec: spack.spec.Spec, module_set_name: str, explicit: bool) -> None: super().__init__(spec, module_set_name, explicit) # FIXME (compiler as nodes): make this a bit more robust candidates = collections.defaultdict(list) for node in spec.traverse(deptype=("link", "run")): - candidates["c"].extend(node.dependencies(virtuals="c")) - candidates["cxx"].extend(node.dependencies(virtuals="c")) + candidates["c"].extend(node.dependencies(virtuals=("c",))) + candidates["cxx"].extend(node.dependencies(virtuals=("c",))) # FIXME (compiler as nodes): decide what to do when we have more than one C compiler if candidates["c"] and len(set(candidates["c"])) == 1: