summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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