aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/detect.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-08-29 20:06:11 -0400
committerEli Schwartz <eschwartz@archlinux.org>2022-09-12 19:16:59 -0400
commitb821a0351136b3b3872e2ba9da8f7c67c4275449 (patch)
tree5ce60dae3f3e71fdf96710ba1f11cdcd91a7d1f4 /mesonbuild/dependencies/detect.py
parent7972c49bda5c2fcd6d647f45f5a5fa250f68f4b6 (diff)
downloadmeson-b821a0351136b3b3872e2ba9da8f7c67c4275449.zip
meson-b821a0351136b3b3872e2ba9da8f7c67c4275449.tar.gz
meson-b821a0351136b3b3872e2ba9da8f7c67c4275449.tar.bz2
dependencies: use better internal representation of factory methods
functools.partial preserves information about how the method was created, lambdas do not. Also, we just want to freeze the first argument and forward the rest anyway. This also lets us get rid of a mypy error that was being ignored.
Diffstat (limited to 'mesonbuild/dependencies/detect.py')
-rw-r--r--mesonbuild/dependencies/detect.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/mesonbuild/dependencies/detect.py b/mesonbuild/dependencies/detect.py
index e4766cd..6e7d6d9 100644
--- a/mesonbuild/dependencies/detect.py
+++ b/mesonbuild/dependencies/detect.py
@@ -178,8 +178,7 @@ def _build_external_dependency_list(name: str, env: 'Environment', for_machine:
if isinstance(packages[lname], type):
entry1 = T.cast('T.Type[ExternalDependency]', packages[lname]) # mypy doesn't understand isinstance(..., type)
if issubclass(entry1, ExternalDependency):
- # TODO: somehow make mypy understand that entry1(env, kwargs) is OK...
- func: T.Callable[[], 'ExternalDependency'] = lambda: entry1(env, kwargs) # type: ignore
+ func: T.Callable[[], 'ExternalDependency'] = functools.partial(entry1, env, kwargs)
dep = [func]
else:
entry2 = T.cast('T.Union[DependencyFactory, WrappedFactoryFunc]', packages[lname])