summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbecker33 <becker33@llnl.gov>2017-07-18 10:03:15 -0700
committerGitHub <noreply@github.com>2017-07-18 10:03:15 -0700
commitd2a63d55fa714588360936f54bcf9cf7cd1d75c7 (patch)
tree2c2ed53d6a549ea6fca32585bc46664c51e55ce3
parent1215c3b20c28edfb8bcb21ad764b0940fa78e268 (diff)
downloadspack-d2a63d55fa714588360936f54bcf9cf7cd1d75c7.tar.gz
spack-d2a63d55fa714588360936f54bcf9cf7cd1d75c7.tar.bz2
spack-d2a63d55fa714588360936f54bcf9cf7cd1d75c7.tar.xz
spack-d2a63d55fa714588360936f54bcf9cf7cd1d75c7.zip
Open ended variants (#4746)
* Change directives to allow open-ended variants more easily * make None default to open-ended
-rw-r--r--lib/spack/spack/directives.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py
index 2b160bc8a3..52e4b83dce 100644
--- a/lib/spack/spack/directives.py
+++ b/lib/spack/spack/directives.py
@@ -372,7 +372,7 @@ def variant(
name,
default=None,
description='',
- values=(True, False),
+ values=None,
multi=False,
validator=None
):
@@ -394,6 +394,12 @@ def variant(
logic. It receives a tuple of values and should raise an instance
of SpackError if the group doesn't meet the additional constraints
"""
+ if values is None:
+ if default in (True, False) or (type(default) is str and
+ default.upper() in ('TRUE', 'FALSE')):
+ values = (True, False)
+ else:
+ values = lambda x: True
if default is None:
default = False if values == (True, False) else ''