diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-02-13 00:39:46 -0500 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2023-02-22 10:32:09 -0800 |
commit | f5c8f8b659f53f228fe3bf5f226de565b40bc172 (patch) | |
tree | 0db3ddd1d11b7169fbfdb20f44dab2b0f344f8cf /mesonbuild/modules | |
parent | 9a2955743e15300ad322695c28dbf5faff1124c9 (diff) | |
download | meson-f5c8f8b659f53f228fe3bf5f226de565b40bc172.zip meson-f5c8f8b659f53f228fe3bf5f226de565b40bc172.tar.gz meson-f5c8f8b659f53f228fe3bf5f226de565b40bc172.tar.bz2 |
python module: fix a few mypy issues
Of particular note: We technically cannot pass a NotFoundDependency out
of a factory lookup, because it doesn't support External interfaces.
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r-- | mesonbuild/modules/python.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 0c3d6a1..a5db019 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -26,7 +26,8 @@ from .. import mesonlib from .. import mlog from ..coredata import UserFeatureOption from ..build import known_shmod_kwargs -from ..dependencies import DependencyMethods, PkgConfigDependency, NotFoundDependency, SystemDependency, ExtraFrameworkDependency +from ..dependencies import (DependencyMethods, PkgConfigDependency, NotFoundDependency, SystemDependency, ExtraFrameworkDependency, + DependencyTypeName, ExternalDependency) from ..dependencies.base import process_method_kw from ..dependencies.detect import get_dep_identifier from ..environment import detect_cpu_family @@ -46,7 +47,7 @@ if T.TYPE_CHECKING: from . import ModuleState from ..build import SharedModule, Data - from ..dependencies import ExternalDependency, Dependency + from ..dependencies import Dependency from ..dependencies.factory import DependencyGenerator from ..environment import Environment from ..interpreter import Interpreter @@ -298,7 +299,9 @@ def python_factory(env: 'Environment', for_machine: 'MachineChoice', installation: 'PythonInstallation') -> 'ExternalDependency': if not pkg_libdir: # there is no LIBPC, so we can't search in it - return NotFoundDependency('python', env) + empty = ExternalDependency(DependencyTypeName('pkgconfig'), env, {}) + empty.name = 'python' + return empty old_pkg_libdir = os.environ.pop('PKG_CONFIG_LIBDIR', None) old_pkg_path = os.environ.pop('PKG_CONFIG_PATH', None) @@ -306,7 +309,7 @@ def python_factory(env: 'Environment', for_machine: 'MachineChoice', try: return PythonPkgConfigDependency(name, env, kwargs, installation, True) finally: - def set_env(name, value): + def set_env(name: str, value: str) -> None: if value is not None: os.environ[name] = value elif name in os.environ: @@ -428,6 +431,7 @@ class PythonExternalProgram(ExternalProgram): 'sysconfig_paths': {}, 'paths': {}, 'platform': 'sentinal', + 'suffix': 'sentinel', 'variables': {}, 'version': '0.0', } |