diff options
Diffstat (limited to 'mesonbuild/modules/python.py')
-rw-r--r-- | mesonbuild/modules/python.py | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index f149ca1..486c63b 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -38,28 +38,52 @@ from ..mesonlib import MachineChoice from ..programs import ExternalProgram, NonExistingExternalProgram if T.TYPE_CHECKING: + from typing_extensions import TypedDict + from . import ModuleState from ..build import SharedModule, Data from ..dependencies import ExternalDependency, Dependency from ..dependencies.factory import DependencyGenerator from ..environment import Environment from ..interpreter import Interpreter + from ..interpreter.kwargs import ExtractRequired from ..interpreterbase.interpreterbase import TYPE_var, TYPE_kwargs from ..backends import InstallData - from typing_extensions import TypedDict + class PythonIntrospectionDict(TypedDict): + install_paths: T.Dict[str, str] + is_pypy: bool + is_venv: bool + link_libpython: bool + sysconfig_paths: T.Dict[str, str] + paths: T.Dict[str, str] + platform: str + suffix: str + variables: T.Dict[str, str] + version: str -mod_kwargs = {'subdir'} -mod_kwargs.update(known_shmod_kwargs) -mod_kwargs -= {'name_prefix', 'name_suffix'} + class PyInstallKw(TypedDict): + + pure: bool + subdir: str + install_tag: T.Optional[str] + class FindInstallationKw(ExtractRequired): + + disabler: bool + modules: T.List[str] -if T.TYPE_CHECKING: _Base = ExternalDependency else: _Base = object + +mod_kwargs = {'subdir'} +mod_kwargs.update(known_shmod_kwargs) +mod_kwargs -= {'name_prefix', 'name_suffix'} + + class _PythonDependencyBase(_Base): def __init__(self, python_holder: 'PythonInstallation', embed: bool): @@ -350,20 +374,6 @@ print(json.dumps({ })) ''' -if T.TYPE_CHECKING: - class PythonIntrospectionDict(TypedDict): - - install_paths: T.Dict[str, str] - is_pypy: bool - is_venv: bool - link_libpython: bool - sysconfig_paths: T.Dict[str, str] - paths: T.Dict[str, str] - platform: str - suffix: str - variables: T.Dict[str, str] - version: str - class PythonExternalProgram(ExternalProgram): def __init__(self, name: str, command: T.Optional[T.List[str]] = None, @@ -474,14 +484,6 @@ class PythonExternalProgram(ExternalProgram): _PURE_KW = KwargInfo('pure', bool, default=True) _SUBDIR_KW = KwargInfo('subdir', str, default='') -if T.TYPE_CHECKING: - - class PyInstallKw(TypedDict): - - pure: bool - subdir: str - install_tag: T.Optional[str] - class PythonInstallation(ExternalProgramHolder): def __init__(self, python: 'PythonExternalProgram', interpreter: 'Interpreter'): @@ -649,15 +651,6 @@ class PythonInstallation(ExternalProgramHolder): return super().path_method(args, kwargs) -if T.TYPE_CHECKING: - from ..interpreter.kwargs import ExtractRequired - - class FindInstallationKw(ExtractRequired): - - disabler: bool - modules: T.List[str] - - class PythonModule(ExtensionModule): @FeatureNew('Python Module', '0.46.0') |