diff options
author | Danny McClanahan <1305167+cosmicexplorer@users.noreply.github.com> | 2021-03-16 23:04:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 16:04:51 -0700 |
commit | 18fbd58fe69576e7b4d60fd75702c2f1c69bd455 (patch) | |
tree | d151f05cb7d761a63e845fed7906fa6e8034a6e0 | |
parent | 912606ad9a6a1751835b91fab52f2f348d80fc0e (diff) | |
download | spack-18fbd58fe69576e7b4d60fd75702c2f1c69bd455.tar.gz spack-18fbd58fe69576e7b4d60fd75702c2f1c69bd455.tar.bz2 spack-18fbd58fe69576e7b4d60fd75702c2f1c69bd455.tar.xz spack-18fbd58fe69576e7b4d60fd75702c2f1c69bd455.zip |
fix weird failure in variant values (#22328)
-rw-r--r-- | lib/spack/spack/variant.py | 15 |
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 |