Package SCons :: Package Variables :: Module EnumVariable'
[hide private]
[frames] | no frames]

Module EnumVariable'

source code

engine.SCons.Variables.EnumVariable

This file defines the option type for SCons allowing only specified
input-values.

Usage example:

  opts = Variables()
  opts.Add(EnumVariable('debug', 'debug output and symbols', 'no',
                      allowed_values=('yes', 'no', 'full'),
                      map={}, ignorecase=2))
  ...
  if env['debug'] == 'full':
    ...

Functions [hide private]
 
EnumVariable(key, help, default, allowed_values, map={}, ignorecase=0)
The input parameters describe a option with only certain values allowed.
source code
 
_validator(key, val, env, vals) source code
Variables [hide private]
  __package__ = 'SCons.Variables'
  __revision__ = 'src/engine/SCons/Variables/EnumVariable.py rel...
Function Details [hide private]

EnumVariable(key, help, default, allowed_values, map={}, ignorecase=0)

source code 

The input parameters describe a option with only certain values
allowed. They are returned with an appropriate converter and
validator appended. The result is usable for input to
Variables.Add().

'key' and 'default' are the values to be passed on to Variables.Add().

'help' will be appended by the allowed values automatically

'allowed_values' is a list of strings, which are allowed as values
for this option.

The 'map'-dictionary may be used for converting the input value
into canonical values (eg. for aliases).

'ignorecase' defines the behaviour of the validator:

If ignorecase == 0, the validator/converter are case-sensitive.
If ignorecase == 1, the validator/converter are case-insensitive.
If ignorecase == 2, the validator/converter is case-insensitive and
                    the converted value will always be lower-case.

The 'validator' tests whether the value is in the list of allowed
values. The 'converter' converts input values according to the
given 'map'-dictionary (unmapped input values are returned
unchanged). 


Variables Details [hide private]

__revision__

Value:
'src/engine/SCons/Variables/EnumVariable.py rel_2.4.0:3365:9259ea1c13d\
7 2015/09/21 14:03:43 bdbaddog'