diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-02-03 21:30:44 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-02-07 22:10:04 +0200 |
commit | 0204895143d4aacf143be952f962dc47e415c187 (patch) | |
tree | 32da3b7f923358b8416f554317adb6dc20041661 /mesonbuild/optinterpreter.py | |
parent | 20c1cb7d02f77ada1446b592d8915ec4945994e3 (diff) | |
download | meson-0204895143d4aacf143be952f962dc47e415c187.zip meson-0204895143d4aacf143be952f962dc47e415c187.tar.gz meson-0204895143d4aacf143be952f962dc47e415c187.tar.bz2 |
Expose integer options to build option files.
Diffstat (limited to 'mesonbuild/optinterpreter.py')
-rw-r--r-- | mesonbuild/optinterpreter.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py index df945ab..7eeaa48 100644 --- a/mesonbuild/optinterpreter.py +++ b/mesonbuild/optinterpreter.py @@ -85,6 +85,16 @@ def ComboParser(name, description, kwargs): raise OptionException('Combo choice elements must be strings.') return coredata.UserComboOption(name, description, choices, kwargs.get('value', choices[0])) +@permitted_kwargs({'value', 'min', 'max'}) +def IntegerParser(name, description, kwargs): + if 'value' not in kwargs: + raise OptionException('Integer option must contain value argument.') + return coredata.UserIntegerOption(name, + description, + kwargs.get('min', None), + kwargs.get('max', None), + kwargs['value']) + @permitted_kwargs({'value', 'choices'}) def string_array_parser(name, description, kwargs): if 'choices' in kwargs: @@ -105,6 +115,7 @@ def string_array_parser(name, description, kwargs): option_types = {'string': StringParser, 'boolean': BooleanParser, 'combo': ComboParser, + 'integer': IntegerParser, 'array': string_array_parser, } |