summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2023-05-11 12:00:07 +0200
committerGitHub <noreply@github.com>2023-05-11 12:00:07 +0200
commit4fa7880b19cb099c22b0f721bc45acee78fdf251 (patch)
treea74b41d8073921ff44729d7eee12f8d141976a31
parentf090b05346e09bfff45929e2ce9805b8f6ec7f74 (diff)
downloadspack-4fa7880b19cb099c22b0f721bc45acee78fdf251.tar.gz
spack-4fa7880b19cb099c22b0f721bc45acee78fdf251.tar.bz2
spack-4fa7880b19cb099c22b0f721bc45acee78fdf251.tar.xz
spack-4fa7880b19cb099c22b0f721bc45acee78fdf251.zip
lmod: fix CompilerSpec concrete version / range (#37604)
-rw-r--r--lib/spack/spack/modules/lmod.py4
-rw-r--r--lib/spack/spack/test/modules/lmod.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/spack/spack/modules/lmod.py b/lib/spack/spack/modules/lmod.py
index 812d4fcc9e..993a34e965 100644
--- a/lib/spack/spack/modules/lmod.py
+++ b/lib/spack/spack/modules/lmod.py
@@ -197,11 +197,11 @@ class LmodConfiguration(BaseConfiguration):
# If it is in the list of supported compilers family -> compiler
if self.spec.name in spack.compilers.supported_compilers():
- provides["compiler"] = spack.spec.CompilerSpec(self.spec.format("{name}{@version}"))
+ provides["compiler"] = spack.spec.CompilerSpec(self.spec.format("{name}{@versions}"))
elif self.spec.name in spack.compilers.package_name_to_compiler_name:
# If it is the package for a supported compiler, but of a different name
cname = spack.compilers.package_name_to_compiler_name[self.spec.name]
- provides["compiler"] = spack.spec.CompilerSpec("%s@%s" % (cname, self.spec.version))
+ provides["compiler"] = spack.spec.CompilerSpec(cname, self.spec.versions)
# All the other tokens in the hierarchy must be virtual dependencies
for x in self.hierarchy_tokens:
diff --git a/lib/spack/spack/test/modules/lmod.py b/lib/spack/spack/test/modules/lmod.py
index 9dd37bb05f..1c842c731e 100644
--- a/lib/spack/spack/test/modules/lmod.py
+++ b/lib/spack/spack/test/modules/lmod.py
@@ -95,7 +95,7 @@ class TestLmod(object):
provides = module.conf.provides
assert "compiler" in provides
- assert provides["compiler"] == spack.spec.CompilerSpec("oneapi@3.0")
+ assert provides["compiler"] == spack.spec.CompilerSpec("oneapi@=3.0")
def test_simple_case(self, modulefile_content, module_configuration):
"""Tests the generation of a simple Lua module file."""