aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-12-06 14:15:13 -0800
committerEli Schwartz <eschwartz93@gmail.com>2022-01-18 17:53:29 -0500
commit55055c3e0ecd7cd0458632393b1ddca68bed8900 (patch)
treecb9b0411378daece97dedbf40ecc87db2701f5d0 /mesonbuild
parent6ad772cb37eefe7f0477c4ce25e67cdf1e10b716 (diff)
downloadmeson-55055c3e0ecd7cd0458632393b1ddca68bed8900.zip
meson-55055c3e0ecd7cd0458632393b1ddca68bed8900.tar.gz
meson-55055c3e0ecd7cd0458632393b1ddca68bed8900.tar.bz2
interpreterobjects: use typed_pos_args for FeatureOpotion
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/interpreter/interpreterobjects.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/mesonbuild/interpreter/interpreterobjects.py b/mesonbuild/interpreter/interpreterobjects.py
index 606de3c..727d097 100644
--- a/mesonbuild/interpreter/interpreterobjects.py
+++ b/mesonbuild/interpreter/interpreterobjects.py
@@ -125,11 +125,8 @@ class FeatureOptionHolder(ObjectHolder[coredata.UserFeatureOption]):
return self.value == 'auto'
@permittedKwargs({'error_message'})
- def require_method(self, args: T.List[TYPE_var], kwargs: TYPE_kwargs) -> coredata.UserFeatureOption:
- if len(args) != 1:
- raise InvalidArguments(f'Expected 1 argument, got {len(args)}.')
- if not isinstance(args[0], bool):
- raise InvalidArguments('boolean argument expected.')
+ @typed_pos_args('feature_option.require', bool)
+ def require_method(self, args: T.Tuple[bool], kwargs: TYPE_kwargs) -> coredata.UserFeatureOption:
error_message = kwargs.pop('error_message', '')
if error_message and not isinstance(error_message, str):
raise InterpreterException("Error message must be a string.")
@@ -145,11 +142,8 @@ class FeatureOptionHolder(ObjectHolder[coredata.UserFeatureOption]):
return self.as_disabled()
@noKwargs
- def disable_auto_if_method(self, args: T.List[TYPE_var], kwargs: TYPE_kwargs) -> coredata.UserFeatureOption:
- if len(args) != 1:
- raise InvalidArguments(f'Expected 1 argument, got {len(args)}.')
- if not isinstance(args[0], bool):
- raise InvalidArguments('boolean argument expected.')
+ @typed_pos_args('feature_option.disable_auto_if', bool)
+ def disable_auto_if_method(self, args: T.Tuple[bool], kwargs: TYPE_kwargs) -> coredata.UserFeatureOption:
return copy.deepcopy(self.held_object) if self.value != 'auto' or not args[0] else self.as_disabled()