aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-06-17 14:05:25 -0700
committerDylan Baker <dylan@pnwbakers.com>2023-08-08 10:06:47 -0700
commit7abd4d39c179f9cf4b8830d44d070b910db8a2d4 (patch)
tree5778315e024c1ddbfdefdd92a0b5bd18883af390 /mesonbuild
parenta151b10988644b24dd45d0a912d5994edccbb6e0 (diff)
downloadmeson-7abd4d39c179f9cf4b8830d44d070b910db8a2d4.zip
meson-7abd4d39c179f9cf4b8830d44d070b910db8a2d4.tar.gz
meson-7abd4d39c179f9cf4b8830d44d070b910db8a2d4.tar.bz2
interpreter: add type annotations to func_declare_dependency
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/interpreter/interpreter.py7
-rw-r--r--mesonbuild/interpreter/kwargs.py18
2 files changed, 22 insertions, 3 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 95a6e1d..61c0b25 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -691,7 +691,8 @@ class Interpreter(InterpreterBase, HoldableObject):
KwargInfo('version', (str, NoneType)),
KwargInfo('objects', ContainerTypeInfo(list, build.ExtractedObjects), listify=True, default=[], since='1.1.0'),
)
- def func_declare_dependency(self, node, args, kwargs):
+ def func_declare_dependency(self, node: mparser.BaseNode, args: T.List[TYPE_var],
+ kwargs: kwtypes.FuncDeclareDependency) -> dependencies.Dependency:
deps = kwargs['dependencies']
incs = self.extract_incdirs(kwargs)
libs = kwargs['link_with']
@@ -2738,7 +2739,7 @@ class Interpreter(InterpreterBase, HoldableObject):
install_tag=install_tag, data_type='configure'))
return mesonlib.File.from_built_file(self.subdir, output)
- def extract_incdirs(self, kwargs, key: str = 'include_directories'):
+ def extract_incdirs(self, kwargs, key: str = 'include_directories') -> T.List[build.IncludeDirs]:
prospectives = extract_as_list(kwargs, key)
if key == 'include_directories':
for i in prospectives:
@@ -2747,7 +2748,7 @@ class Interpreter(InterpreterBase, HoldableObject):
f'Use include_directories({i!r}) instead', location=self.current_node)
break
- result = []
+ result: T.List[build.IncludeDirs] = []
for p in prospectives:
if isinstance(p, build.IncludeDirs):
result.append(p)
diff --git a/mesonbuild/interpreter/kwargs.py b/mesonbuild/interpreter/kwargs.py
index 2a1cd61..48e483e 100644
--- a/mesonbuild/interpreter/kwargs.py
+++ b/mesonbuild/interpreter/kwargs.py
@@ -12,6 +12,7 @@ from typing_extensions import TypedDict, Literal, Protocol
from .. import build
from .. import coredata
from ..compilers import Compiler
+from ..dependencies.base import Dependency
from ..mesonlib import EnvironmentVariables, MachineChoice, File, FileMode, FileOrString, OptionKey
from ..modules.cmake import CMakeSubprojectOptions
from ..programs import ExternalProgram
@@ -360,3 +361,20 @@ class Jar(_BaseBuildTarget):
main_class: str
java_resources: T.Optional[build.StructuredSources]
+
+
+class FuncDeclareDependency(TypedDict):
+
+ compile_args: T.List[str]
+ d_import_dirs: T.List[T.Union[build.IncludeDirs, str]]
+ d_module_versions: T.List[T.Union[str, int]]
+ dependencies: T.List[Dependency]
+ extra_files: T.List[FileOrString]
+ include_directories: T.List[T.Union[build.IncludeDirs, str]]
+ link_args: T.List[str]
+ link_whole: T.List[T.Union[build.StaticLibrary, build.CustomTarget, build.CustomTargetIndex]]
+ link_with: T.List[build.LibTypes]
+ objects: T.List[build.ExtractedObjects]
+ sources: T.List[T.Union[FileOrString, build.GeneratedTypes]]
+ variables: T.Dict[str, str]
+ version: T.Optional[str]