modules/python3: use typed_kwargs for extension_module

Just like python, but for the python3 module
pull/12050/head
Dylan Baker 1 year ago committed by Eli Schwartz
parent fdbce211b2
commit 36301eaf8a
  1. 15
      mesonbuild/modules/python3.py

@ -14,13 +14,21 @@
from __future__ import annotations
import sysconfig
from .. import mesonlib
import typing as T
from .. import mesonlib
from . import ExtensionModule, ModuleInfo
from ..interpreterbase import typed_pos_args, noPosargs, noKwargs, permittedKwargs
from ..interpreter.type_checking import SHARED_MOD_KWS
from ..interpreterbase import typed_kwargs, typed_pos_args, noPosargs, noKwargs, permittedKwargs
from ..build import known_shmod_kwargs
from ..programs import ExternalProgram
if T.TYPE_CHECKING:
from ..interpreter.kwargs import SharedModule as SharedModuleKW
_MOD_KWARGS = [k for k in SHARED_MOD_KWS if k.name not in {'name_prefix', 'name_suffix'}]
class Python3Module(ExtensionModule):
@ -36,7 +44,8 @@ class Python3Module(ExtensionModule):
})
@permittedKwargs(known_shmod_kwargs)
def extension_module(self, state, args, kwargs):
@typed_kwargs('python3.extension_module', *_MOD_KWARGS, allow_unknown=True)
def extension_module(self, state, args, kwargs: SharedModuleKW):
if 'name_prefix' in kwargs:
raise mesonlib.MesonException('Name_prefix is set automatically, specifying it is forbidden.')
if 'name_suffix' in kwargs:

Loading…
Cancel
Save