diff options
-rw-r--r-- | lib/spack/spack/directives.py | 8 |
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 '' |