diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2025-09-23 09:45:47 -0700 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-10-15 10:21:46 -0700 |
| commit | 943638976e692f2d9b073bedd80481653cb3bd31 (patch) | |
| tree | c80f9c035f4513bb2c7ca9f6819cfd9fa911e472 /mesonbuild/ast | |
| parent | 5d05b1e2695d9f87e4f2d5f22c25a7b28e9f5657 (diff) | |
| download | meson-943638976e692f2d9b073bedd80481653cb3bd31.tar.gz | |
build: Add a TypedDict for BuildTarget keyword arguments
This has the "processed" keyword arguments that the interpreter is
supposed to create for us, or that we expect internal users to build by
build.
This requires some hacking around in the rust module for the moment
because we suddenly have a type.
Diffstat (limited to 'mesonbuild/ast')
| -rw-r--r-- | mesonbuild/ast/introspection.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py index b4cf8203c..360edae31 100644 --- a/mesonbuild/ast/introspection.py +++ b/mesonbuild/ast/introspection.py @@ -19,7 +19,7 @@ from ..mparser import BaseNode, ArrayNode, ElementaryNode, IdNode, FunctionNode, from .interpreter import AstInterpreter, IntrospectionBuildTarget, IntrospectionDependency if T.TYPE_CHECKING: - from ..build import BuildTarget + from ..build import BuildTarget, BuildTargetKeywordArguments from ..interpreterbase import TYPE_var from .visitor import AstVisitor @@ -243,9 +243,10 @@ class IntrospectionInterpreter(AstInterpreter): extraf_nodes = v # Make sure nothing can crash when creating the build class - kwargs_reduced = {k: v for k, v in kwargs.items() if k in targetclass.known_kwargs and k in {'install', 'build_by_default', 'build_always', 'name_prefix'}} - kwargs_reduced = {k: v.value if isinstance(v, ElementaryNode) else v for k, v in kwargs_reduced.items()} - kwargs_reduced = {k: v for k, v in kwargs_reduced.items() if not isinstance(v, (BaseNode, UnknownValue))} + _kwargs_reduced = {k: v for k, v in kwargs.items() if k in targetclass.known_kwargs and k in {'install', 'build_by_default', 'build_always', 'name_prefix'}} + _kwargs_reduced = {k: v.value if isinstance(v, ElementaryNode) else v for k, v in _kwargs_reduced.items()} + _kwargs_reduced = {k: v for k, v in _kwargs_reduced.items() if not isinstance(v, (BaseNode, UnknownValue))} + kwargs_reduced = T.cast('BuildTargetKeywordArguments', _kwargs_reduced) for_machine = MachineChoice.BUILD if kwargs.get('native', False) else MachineChoice.HOST objects: T.List[T.Any] = [] empty_sources: T.List[T.Any] = [] |
