summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth R. Johnson <johnsonsr@ornl.gov>2020-02-26 12:03:28 -0500
committerTodd Gamblin <tgamblin@llnl.gov>2020-03-20 11:33:07 -0700
commitf3a1a8c6fe13b6f92a6c44e771aff5d1f9683a77 (patch)
treec98837e3c103b9ab9d449f263dcb8e5fadda26fe
parentb02981f10ccfa336d6f777d0517468ba0429c42f (diff)
downloadspack-f3a1a8c6fe13b6f92a6c44e771aff5d1f9683a77.tar.gz
spack-f3a1a8c6fe13b6f92a6c44e771aff5d1f9683a77.tar.bz2
spack-f3a1a8c6fe13b6f92a6c44e771aff5d1f9683a77.tar.xz
spack-f3a1a8c6fe13b6f92a6c44e771aff5d1f9683a77.zip
Uniquify suffixes added to module names (#14920)
-rw-r--r--lib/spack/spack/modules/common.py1
-rw-r--r--lib/spack/spack/test/data/modules/tcl/suffix.yaml1
-rw-r--r--lib/spack/spack/test/modules/tcl.py3
3 files changed, 4 insertions, 1 deletions
diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py
index c09a225116..8dee443eb3 100644
--- a/lib/spack/spack/modules/common.py
+++ b/lib/spack/spack/modules/common.py
@@ -428,6 +428,7 @@ class BaseConfiguration(object):
for constraint, suffix in self.conf.get('suffixes', {}).items():
if constraint in self.spec:
suffixes.append(suffix)
+ suffixes = sorted(set(suffixes))
if self.hash:
suffixes.append(self.hash)
return suffixes
diff --git a/lib/spack/spack/test/data/modules/tcl/suffix.yaml b/lib/spack/spack/test/data/modules/tcl/suffix.yaml
index 015ac63b0f..57703e1733 100644
--- a/lib/spack/spack/test/data/modules/tcl/suffix.yaml
+++ b/lib/spack/spack/test/data/modules/tcl/suffix.yaml
@@ -5,3 +5,4 @@ tcl:
suffixes:
'+debug': foo
'~debug': bar
+ '^mpich': foo
diff --git a/lib/spack/spack/test/modules/tcl.py b/lib/spack/spack/test/modules/tcl.py
index 70eee24461..40cb7be5ef 100644
--- a/lib/spack/spack/test/modules/tcl.py
+++ b/lib/spack/spack/test/modules/tcl.py
@@ -215,9 +215,10 @@ class TestTcl(object):
writer, spec = factory('mpileaks+debug arch=x86-linux')
assert 'foo' in writer.layout.use_name
+ assert 'foo-foo' not in writer.layout.use_name
writer, spec = factory('mpileaks~debug arch=x86-linux')
- assert 'bar' in writer.layout.use_name
+ assert 'bar-foo' in writer.layout.use_name
def test_setup_environment(self, modulefile_content, module_configuration):
"""Tests the internal set-up of run-time environment."""