From 09d7da19c18d788e48cb46dbf10d791dabdf7eb9 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 1 Jul 2021 10:15:52 -0700 Subject: [PATCH] interpreter: use typed_kwargs for include_directories --- mesonbuild/interpreter/interpreter.py | 6 +++--- mesonbuild/interpreter/kwargs.py | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 66f2dd29f..baf2e9de6 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -2268,11 +2268,11 @@ This will become a hard error in the future.''' % kwargs['input'], location=self raise InterpreterException('Include directory objects can only be created from strings or include directories.') return result - @permittedKwargs({'is_system'}) @typed_pos_args('include_directories', varargs=str) + @typed_kwargs('include_directories', KwargInfo('is_system', bool, default=False)) def func_include_directories(self, node: mparser.BaseNode, args: T.Tuple[T.List[str]], - kwargs: 'TYPE_kwargs') -> build.IncludeDirs: - return self.build_incdir_object(args[0], kwargs.get('is_system', False)) + kwargs: 'kwargs.FuncIncludeDirectories') -> build.IncludeDirs: + return self.build_incdir_object(args[0], kwargs['is_system']) def build_incdir_object(self, incdir_strings: T.List[str], is_system: bool = False) -> build.IncludeDirs: if not isinstance(is_system, bool): diff --git a/mesonbuild/interpreter/kwargs.py b/mesonbuild/interpreter/kwargs.py index b92b66fd7..2851e5af5 100644 --- a/mesonbuild/interpreter/kwargs.py +++ b/mesonbuild/interpreter/kwargs.py @@ -137,3 +137,8 @@ class FuncInstallMan(TypedDict): class FuncImportModule(ExtractRequired): disabler: bool + + +class FuncIncludeDirectories(TypedDict): + + is_system: bool