summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth R. Johnson <johnsonsr@ornl.gov>2020-02-26 12:03:28 -0500
committerGitHub <noreply@github.com>2020-02-26 18:03:28 +0100
commit6c445a2c0f907f8ca208841b2660e700bfb1665d (patch)
treeff7f781583bb1e679b00e5262550e0cfe191773b
parent1c227db7a9e829ab6637b29cfcd80d2b6b3db38b (diff)
downloadspack-6c445a2c0f907f8ca208841b2660e700bfb1665d.tar.gz
spack-6c445a2c0f907f8ca208841b2660e700bfb1665d.tar.bz2
spack-6c445a2c0f907f8ca208841b2660e700bfb1665d.tar.xz
spack-6c445a2c0f907f8ca208841b2660e700bfb1665d.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 d6fb536e8f..b4e1d553a6 100644
--- a/lib/spack/spack/modules/common.py
+++ b/lib/spack/spack/modules/common.py
@@ -424,6 +424,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."""