modules/python3: use typed_kwargs for extension_module
Just like python, but for the python3 module
This commit is contained in:
parent
fdbce211b2
commit
36301eaf8a
|
@ -14,13 +14,21 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import sysconfig
|
import sysconfig
|
||||||
from .. import mesonlib
|
import typing as T
|
||||||
|
|
||||||
|
from .. import mesonlib
|
||||||
from . import ExtensionModule, ModuleInfo
|
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 ..build import known_shmod_kwargs
|
||||||
from ..programs import ExternalProgram
|
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):
|
class Python3Module(ExtensionModule):
|
||||||
|
|
||||||
|
@ -36,7 +44,8 @@ class Python3Module(ExtensionModule):
|
||||||
})
|
})
|
||||||
|
|
||||||
@permittedKwargs(known_shmod_kwargs)
|
@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:
|
if 'name_prefix' in kwargs:
|
||||||
raise mesonlib.MesonException('Name_prefix is set automatically, specifying it is forbidden.')
|
raise mesonlib.MesonException('Name_prefix is set automatically, specifying it is forbidden.')
|
||||||
if 'name_suffix' in kwargs:
|
if 'name_suffix' in kwargs:
|
||||||
|
|
Loading…
Reference in New Issue