summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDanny McClanahan <1305167+cosmicexplorer@users.noreply.github.com>2021-03-16 23:04:51 +0000
committerGitHub <noreply@github.com>2021-03-16 16:04:51 -0700
commit18fbd58fe69576e7b4d60fd75702c2f1c69bd455 (patch)
treed151f05cb7d761a63e845fed7906fa6e8034a6e0 /lib
parent912606ad9a6a1751835b91fab52f2f348d80fc0e (diff)
downloadspack-18fbd58fe69576e7b4d60fd75702c2f1c69bd455.tar.gz
spack-18fbd58fe69576e7b4d60fd75702c2f1c69bd455.tar.bz2
spack-18fbd58fe69576e7b4d60fd75702c2f1c69bd455.tar.xz
spack-18fbd58fe69576e7b4d60fd75702c2f1c69bd455.zip
fix weird failure in variant values (#22328)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/variant.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/spack/spack/variant.py b/lib/spack/spack/variant.py
index 51918af737..be3b74b97d 100644
--- a/lib/spack/spack/variant.py
+++ b/lib/spack/spack/variant.py
@@ -282,8 +282,21 @@ class AbstractVariant(object):
# to a set
self._value = tuple(sorted(set(value)))
+ def _cmp_value(self):
+ """Returns a tuple of strings containing the values stored in
+ the variant.
+
+ Returns:
+ tuple of str: values stored in the variant
+ """
+ value = self._value
+ if not isinstance(value, tuple):
+ value = (value,)
+ stringified = tuple(str(x) for x in value)
+ return stringified
+
def _cmp_key(self):
- return self.name, self.value
+ return self.name, self._cmp_value()
def copy(self):
"""Returns an instance of a variant equivalent to self