summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/__init__.py2
-rw-r--r--lib/spack/spack/test/cmd/find.py15
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/spack/spack/cmd/__init__.py b/lib/spack/spack/cmd/__init__.py
index f07173d9fc..df482edfd4 100644
--- a/lib/spack/spack/cmd/__init__.py
+++ b/lib/spack/spack/cmd/__init__.py
@@ -347,7 +347,7 @@ def iter_groups(specs, indent, all_headers):
spack.spec.architecture_color,
architecture if architecture else "no arch",
spack.spec.compiler_color,
- f"{compiler.name}@{compiler.version}" if compiler else "no compiler",
+ f"{compiler}" if compiler else "no compiler",
)
# Sometimes we want to display specs that are not yet concretized.
diff --git a/lib/spack/spack/test/cmd/find.py b/lib/spack/spack/test/cmd/find.py
index 5c520a97e1..249f93257f 100644
--- a/lib/spack/spack/test/cmd/find.py
+++ b/lib/spack/spack/test/cmd/find.py
@@ -357,3 +357,18 @@ def test_find_loaded(database, working_env):
output = find("--loaded")
expected = find()
assert output == expected
+
+
+@pytest.mark.regression("37712")
+def test_environment_with_version_range_in_compiler_doesnt_fail(tmp_path):
+ """Tests that having an active environment with a root spec containing a compiler constrained
+ by a version range (i.e. @X.Y rather the single version than @=X.Y) doesn't result in an error
+ when invoking "spack find".
+ """
+ test_environment = ev.create_in_dir(tmp_path)
+ test_environment.add("zlib %gcc@12.1.0")
+ test_environment.write()
+
+ with test_environment:
+ output = find()
+ assert "zlib%gcc@12.1.0" in output