aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-06-04 11:44:17 -0700
committerDylan Baker <dylan@pnwbakers.com>2021-06-04 20:10:05 -0700
commite0f62d181213a7955d04facffecc52196a08d776 (patch)
tree47298be2b174f14bc46b3a1c809542ff58ce52a5
parent6f562ed734f2a1df13dca399f04c996d9493a2f1 (diff)
downloadmeson-e0f62d181213a7955d04facffecc52196a08d776.zip
meson-e0f62d181213a7955d04facffecc52196a08d776.tar.gz
meson-e0f62d181213a7955d04facffecc52196a08d776.tar.bz2
dependencies/detect: Add type annotations to find_external_dependency
-rw-r--r--mesonbuild/dependencies/detect.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/mesonbuild/dependencies/detect.py b/mesonbuild/dependencies/detect.py
index e70478e..38bd2ad 100644
--- a/mesonbuild/dependencies/detect.py
+++ b/mesonbuild/dependencies/detect.py
@@ -25,6 +25,7 @@ import typing as T
if T.TYPE_CHECKING:
from ..environment import Environment
+ from .base import ExternalDependency
from .factory import DependencyType
# These must be defined in this file to avoid cyclical references.
@@ -69,7 +70,7 @@ display_name_map = {
'wxwidgets': 'WxWidgets',
}
-def find_external_dependency(name, env, kwargs):
+def find_external_dependency(name: str, env: 'Environment', kwargs: T.Dict[str, object]) -> 'ExternalDependency':
assert(name)
required = kwargs.get('required', True)
if not isinstance(required, bool):
@@ -92,8 +93,8 @@ def find_external_dependency(name, env, kwargs):
# build a list of dependency methods to try
candidates = _build_external_dependency_list(name, env, for_machine, kwargs)
- pkg_exc = []
- pkgdep = []
+ pkg_exc: T.List[DependencyException] = []
+ pkgdep: T.List['ExternalDependency'] = []
details = ''
for c in candidates:
@@ -154,7 +155,7 @@ def find_external_dependency(name, env, kwargs):
def _build_external_dependency_list(name: str, env: 'Environment', for_machine: MachineChoice,
- kwargs: T.Dict[str, T.Any]) -> T.List['DependencyType']:
+ kwargs: T.Dict[str, T.Any]) -> T.List[T.Callable[[], 'ExternalDependency']]:
# First check if the method is valid
if 'method' in kwargs and kwargs['method'] not in [e.value for e in DependencyMethods]:
raise DependencyException('method {!r} is invalid'.format(kwargs['method']))