diff options
| -rw-r--r-- | mesonbuild/dependencies/base.py | 3 | ||||
| -rw-r--r-- | mesonbuild/dependencies/python.py | 10 | ||||
| -rw-r--r-- | mesonbuild/modules/python.py | 9 |
3 files changed, 14 insertions, 8 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index 547beb61e..685e1eaca 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -58,6 +58,9 @@ if T.TYPE_CHECKING: static: T.Optional[bool] version: T.List[str] + # Only in the python dependency + embed: bool + _MissingCompilerBase = Compiler else: _MissingCompilerBase = object diff --git a/mesonbuild/dependencies/python.py b/mesonbuild/dependencies/python.py index 0f9a618b6..021bd3294 100644 --- a/mesonbuild/dependencies/python.py +++ b/mesonbuild/dependencies/python.py @@ -1,4 +1,4 @@ -# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: Apache-2. # Copyright 2022 The Meson development team from __future__ import annotations @@ -484,7 +484,7 @@ class PythonPkgConfigDependency(PkgConfigDependency, _PythonDependencyBase): pkgconfig_paths = [pkg_libdir] if pkg_libdir else [] PkgConfigDependency.__init__(self, pkg_name, environment, kwargs, extra_paths=pkgconfig_paths) - _PythonDependencyBase.__init__(self, installation, T.cast('bool', kwargs.get('embed', False)), for_machine) + _PythonDependencyBase.__init__(self, installation, kwargs.get('embed', False), for_machine) if pkg_libdir and not self.is_found: mlog.debug(f'{pkg_name!r} could not be found in {pkg_libdir_origin}, ' @@ -512,7 +512,7 @@ class PythonFrameworkDependency(ExtraFrameworkDependency, _PythonDependencyBase) kwargs: DependencyObjectKWs, installation: 'BasicPythonExternalProgram', for_machine: 'MachineChoice'): ExtraFrameworkDependency.__init__(self, name, environment, kwargs) - _PythonDependencyBase.__init__(self, installation, T.cast('bool', kwargs.get('embed', False)), for_machine) + _PythonDependencyBase.__init__(self, installation, kwargs.get('embed', False), for_machine) class PythonSystemDependency(SystemDependency, _PythonDependencyBase): @@ -521,7 +521,7 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase): kwargs: DependencyObjectKWs, installation: 'BasicPythonExternalProgram', for_machine: 'MachineChoice'): SystemDependency.__init__(self, name, environment, kwargs) - _PythonDependencyBase.__init__(self, installation, T.cast('bool', kwargs.get('embed', False)), for_machine) + _PythonDependencyBase.__init__(self, installation, kwargs.get('embed', False), for_machine) # For most platforms, match pkg-config behavior. iOS is a special case; # check for that first, so that check takes priority over @@ -569,7 +569,7 @@ def python_factory(env: 'Environment', for_machine: 'MachineChoice', # We can't use the factory_methods decorator here, as we need to pass the # extra installation argument methods = process_method_kw({DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM}, kwargs) - embed = T.cast('bool', kwargs.get('embed', False)) + embed = kwargs.get('embed', False) candidates: T.List['DependencyGenerator'] = [] from_installation = installation is not None # When not invoked through the python module, default installation. diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 3cebdb33c..55cb24ea5 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -20,7 +20,7 @@ from ..interpreter.type_checking import NoneType, DEPENDENCY_KWS, PRESERVE_PATH_ from ..interpreterbase import ( noPosargs, noKwargs, permittedKwargs, ContainerTypeInfo, InvalidArguments, typed_pos_args, typed_kwargs, KwargInfo, - FeatureNew, FeatureNewKwargs, disablerIfNotFound, InterpreterObject + FeatureNew, disablerIfNotFound, InterpreterObject ) from ..mesonlib import MachineChoice from ..options import OptionKey @@ -268,9 +268,12 @@ class PythonInstallation(_ExternalProgramHolder['PythonExternalProgram']): @disablerIfNotFound @permittedKwargs(permitted_dependency_kwargs | {'embed'}) - @FeatureNewKwargs('python_installation.dependency', '0.53.0', ['embed']) @noPosargs - @typed_kwargs('python_installation.dependency', *DEPENDENCY_KWS, allow_unknown=True) + @typed_kwargs( + 'python_installation.dependency', + *DEPENDENCY_KWS, + KwargInfo('embed', bool, default=False, since='0.53.0'), + ) @InterpreterObject.method('dependency') def dependency_method(self, args: T.List['TYPE_var'], kwargs: FuncDependency) -> 'Dependency': disabled, required, feature = extract_required_kwarg(kwargs, self.subproject) |
