Skip to content

Commit

Permalink
interpreter: use typed_kwargs for build_target.native
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbaker committed Oct 17, 2023
1 parent 2fc8729 commit 357abf5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mesonbuild/interpreter/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3300,7 +3300,7 @@ def build_target_decorator_caller(self, node, args, kwargs):
build_target_decorator_caller(self, node, args, kwargs)

name, sources = args
for_machine = self.machine_from_native_kwarg(kwargs)
for_machine = kwargs['native']
if kwargs.get('rust_crate_type') == 'proc-macro':
# Silently force to native because that's the only sensible value
# and rust_crate_type is deprecated any way.
Expand Down
1 change: 1 addition & 0 deletions mesonbuild/interpreter/kwargs.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ class _BaseBuildTarget(TypedDict):
build_by_default: bool
install: bool
install_mode: FileMode
native: MachineChoice
override_options: T.Dict[OptionKey, T.Union[str, int, bool, T.List[str]]]
depend_files: NotRequired[T.List[File]]

Expand Down
1 change: 1 addition & 0 deletions mesonbuild/interpreter/type_checking.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ def link_whole_validator(values: T.List[T.Union[StaticLibrary, CustomTarget, Cus
KwargInfo('build_by_default', bool, default=True, since='0.38.0'),
INSTALL_KW,
INSTALL_MODE_KW,
NATIVE_KW,
]

# Applies to all build_target classes except jar
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/modules/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def extension_module_method(self, args: T.Tuple[str, T.List[BuildTargetSource]],
# into the linker path when not running in debug mode via a series #pragma comment(lib, "")
# directives. We manually override these here as this interferes with the intended
# use of the 'limited_api' kwarg
for_machine = self.interpreter.machine_from_native_kwarg(kwargs)
for_machine = kwargs['native']
compilers = self.interpreter.environment.coredata.compilers[for_machine]
if any(compiler.get_id() == 'msvc' for compiler in compilers.values()):
pydep_copy = copy.copy(pydep)
Expand Down

0 comments on commit 357abf5

Please sign in to comment.