diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2025-01-10 11:41:27 -0800 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-10-15 10:21:46 -0700 |
| commit | 58bd07209e043a22c4c63d5210d6f5537de24f66 (patch) | |
| tree | 96382c83b426d1d1e6eedd2a07cc839910ccc0bc | |
| parent | 0baff0d0427082690eec9bbfa000d0a7a9ea249b (diff) | |
| download | meson-58bd07209e043a22c4c63d5210d6f5537de24f66.tar.gz | |
build: use a TypedDict for SharedModule kwargs
| -rw-r--r-- | mesonbuild/build.py | 6 | ||||
| -rw-r--r-- | mesonbuild/interpreter/kwargs.py | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 9aa8edf01..0ad571c8b 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -49,6 +49,7 @@ if T.TYPE_CHECKING: from .mesonlib import ExecutableSerialisation, FileMode, FileOrString from .modules import ModuleState from .mparser import BaseNode + from .interpreter.kwargs import RustAbi GeneratedTypes: TypeAlias = T.Union['CustomTarget', 'CustomTargetIndex', 'GeneratedList'] LibTypes: TypeAlias = T.Union['SharedLibrary', 'StaticLibrary', 'CustomTarget', 'CustomTargetIndex'] @@ -116,6 +117,11 @@ if T.TYPE_CHECKING: pie: bool vs_module_defs: T.Union[str, File, CustomTarget, CustomTargetIndex] + class SharedModuleKeywordArguments(BuildTargetKeywordArguments, total=False): + + vs_module_defs: T.Union[str, File, CustomTarget, CustomTargetIndex] + rust_abi: T.Optional[RustAbi] + DEFAULT_STATIC_LIBRARY_NAMES: T.Mapping[str, T.Tuple[str, str]] = { 'unix': ('lib', 'a'), 'windows': ('', 'lib'), diff --git a/mesonbuild/interpreter/kwargs.py b/mesonbuild/interpreter/kwargs.py index d863b0892..22dde255d 100644 --- a/mesonbuild/interpreter/kwargs.py +++ b/mesonbuild/interpreter/kwargs.py @@ -19,8 +19,8 @@ from ..modules.cmake import CMakeSubprojectOptions from ..programs import ExternalProgram from .type_checking import PkgConfigDefineType, SourcesVarargsType -if T.TYPE_CHECKING: - TestArgs = T.Union[str, File, build.Target, ExternalProgram] +TestArgs = T.Union[str, File, build.Target, ExternalProgram] +RustAbi = Literal['rust', 'c'] class FuncAddProjectArgs(TypedDict): @@ -390,7 +390,7 @@ class _BuildTarget(_BaseBuildTarget): class _LibraryMixin(TypedDict): - rust_abi: T.Optional[Literal['c', 'rust']] + rust_abi: T.Optional[RustAbi] class Executable(_BuildTarget): |
