From 011f13bcdcf366d43986227e61881e04f1d33c95 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 1 Jul 2021 10:45:52 -0700 Subject: [PATCH] interpreter: use typed_pos_args for add_langauges --- mesonbuild/interpreter/interpreter.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 7c737958d..3684a86dc 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -1194,15 +1194,16 @@ external dependencies (including libraries) must go to "dependencies".''') @FeatureNewKwargs('add_languages', '0.54.0', ['native']) @permittedKwargs({'required', 'native'}) - @stringArgs - def func_add_languages(self, node, args, kwargs): + @typed_pos_args('add_languages', varargs=str) + def func_add_languages(self, node: mparser.FunctionNode, args: T.Tuple[T.List[str]], kwargs: 'TYPE_kwargs') -> bool: + langs = args[0] disabled, required, feature = extract_required_kwarg(kwargs, self.subproject) if disabled: - for lang in sorted(args, key=compilers.sort_clink): + for lang in sorted(langs, key=compilers.sort_clink): mlog.log('Compiler for language', mlog.bold(lang), 'skipped: feature', mlog.bold(feature), 'disabled') return False if 'native' in kwargs: - return self.add_languages(args, required, self.machine_from_native_kwarg(kwargs)) + return self.add_languages(langs, required, self.machine_from_native_kwarg(kwargs)) else: # absent 'native' means 'both' for backwards compatibility tv = FeatureNew.get_target_version(self.subproject) @@ -1210,8 +1211,8 @@ external dependencies (including libraries) must go to "dependencies".''') mlog.warning('add_languages is missing native:, assuming languages are wanted for both host and build.', location=self.current_node) - success = self.add_languages(args, False, MachineChoice.BUILD) - success &= self.add_languages(args, required, MachineChoice.HOST) + success = self.add_languages(langs, False, MachineChoice.BUILD) + success &= self.add_languages(langs, required, MachineChoice.HOST) return success @noArgsFlattening