diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2024-08-29 15:47:20 -0700 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2025-02-05 17:45:38 +0200 |
| commit | ba3460eb11bbceaf4fef7352bf286cf27184c99a (patch) | |
| tree | ef001dc11ac342d82296a7e41560dac04f8b89ce /mesonbuild/optinterpreter.py | |
| parent | 0e11b90d6f2f9c3e18cb8ff84b1622640666e826 (diff) | |
| download | meson-ba3460eb11bbceaf4fef7352bf286cf27184c99a.tar.gz | |
options: Add an EnumeratedUserOption class
This will allow us to take choices out of the UserOption class, which
doesn't actually use this attribute.
Diffstat (limited to 'mesonbuild/optinterpreter.py')
| -rw-r--r-- | mesonbuild/optinterpreter.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py index 99efd511e..8c0d1daec 100644 --- a/mesonbuild/optinterpreter.py +++ b/mesonbuild/optinterpreter.py @@ -213,7 +213,7 @@ class OptionInterpreter: KwargInfo('value', str, default=''), ) def string_parser(self, name: str, description: str, args: T.Tuple[bool, _DEPRECATED_ARGS], kwargs: StringArgs) -> options.UserOption: - return options.UserStringOption(name, description, kwargs['value'], None, *args) + return options.UserStringOption(name, description, kwargs['value'], *args) @typed_kwargs( 'boolean option', @@ -239,7 +239,7 @@ class OptionInterpreter: value = kwargs['value'] if value is None: value = kwargs['choices'][0] - return options.UserComboOption(name, description, value, choices, *args) + return options.UserComboOption(name, description, value, *args, choices) @typed_kwargs( 'integer option', @@ -255,7 +255,7 @@ class OptionInterpreter: ) def integer_parser(self, name: str, description: str, args: T.Tuple[bool, _DEPRECATED_ARGS], kwargs: IntegerArgs) -> options.UserOption: return options.UserIntegerOption( - name, description, kwargs['value'], None, *args, min_value=kwargs['min'], max_value=kwargs['max']) + name, description, kwargs['value'], *args, min_value=kwargs['min'], max_value=kwargs['max']) @typed_kwargs( 'string array option', @@ -270,12 +270,11 @@ class OptionInterpreter: FeatureDeprecated('String value for array option', '1.3.0').use(self.subproject) else: raise mesonlib.MesonException('Value does not define an array: ' + value) - # XXX: the value of choices is correct, the annotation is wrong. - # the annotation will be fixed in a later commit - return options.UserArrayOption(name, description, value, - choices=choices, # type: ignore[arg-type] - yielding=args[0], - deprecated=args[1]) + return options.UserStringArrayOption( + name, description, value, + choices=choices, + yielding=args[0], + deprecated=args[1]) @typed_kwargs( 'feature option', |
