summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbecker33 <becker33@llnl.gov>2016-08-11 11:33:54 -0700
committerGitHub <noreply@github.com>2016-08-11 11:33:54 -0700
commitec7f58bf966f026eed6eef9b4b66bd35940a9b95 (patch)
tree53bd3ca9d6fcb035aff19161be29691195b78dcc
parent1be63348b55a23b7088977b18e78954aab9f4be9 (diff)
parentaa860bf4dfe6ebe96f4de5bd2c91e4223eca4d7b (diff)
downloadspack-ec7f58bf966f026eed6eef9b4b66bd35940a9b95.tar.gz
spack-ec7f58bf966f026eed6eef9b4b66bd35940a9b95.tar.bz2
spack-ec7f58bf966f026eed6eef9b4b66bd35940a9b95.tar.xz
spack-ec7f58bf966f026eed6eef9b4b66bd35940a9b95.zip
Merge pull request #1493 from xjrc/bugfix/nonbool-variants
Bug Fix : Allow Packages to Have Variants w/ Non-Bool, Non-String Defaults
-rw-r--r--lib/spack/spack/spec.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 0d72d454c6..316b7d6a8c 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -332,11 +332,10 @@ class VariantSpec(object):
return VariantSpec(self.name, self.value)
def __str__(self):
- if self.value in [True, False]:
- out = '+' if self.value else '~'
- return out + self.name
+ if type(self.value) == bool:
+ return '{0}{1}'.format('+' if self.value else '~', self.name)
else:
- return ' ' + self.name + "=" + self.value
+ return ' {0}={1}'.format(self.name, self.value)
class VariantMap(HashableMap):