From b8b2d87567af8e7f556e290c3585e7ac462679b6 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 29 Jan 2023 13:48:22 -0500 Subject: dependencies: switch the delayed-import mechanism for custom dependencies Simply store the module it is expected to be found in. That module then appends to the packages dict, which guarantees mypy can verify that it's got the right type -- there is no casting needed. --- mesonbuild/dependencies/python.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mesonbuild/dependencies/python.py') diff --git a/mesonbuild/dependencies/python.py b/mesonbuild/dependencies/python.py index 24100071e..160772888 100644 --- a/mesonbuild/dependencies/python.py +++ b/mesonbuild/dependencies/python.py @@ -20,6 +20,7 @@ import typing as T from .. import mesonlib, mlog from .base import process_method_kw, DependencyMethods, DependencyTypeName, ExternalDependency, SystemDependency from .configtool import ConfigToolDependency +from .detect import packages from .factory import DependencyFactory from .framework import ExtraFrameworkDependency from .pkgconfig import PkgConfigDependency @@ -407,7 +408,9 @@ def python_factory(env: 'Environment', for_machine: 'MachineChoice', return candidates -pybind11_factory = DependencyFactory( +packages['python3'] = python_factory + +packages['pybind11'] = pybind11_factory = DependencyFactory( 'pybind11', [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.CMAKE], configtool_class=Pybind11ConfigToolDependency, -- cgit v1.2.3