From 18fbd58fe69576e7b4d60fd75702c2f1c69bd455 Mon Sep 17 00:00:00 2001 From: Danny McClanahan <1305167+cosmicexplorer@users.noreply.github.com> Date: Tue, 16 Mar 2021 23:04:51 +0000 Subject: fix weird failure in variant values (#22328) --- lib/spack/spack/variant.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-60-g2f50