aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-10-28 15:06:27 -0400
committerEli Schwartz <eschwartz93@gmail.com>2023-06-01 18:47:03 -0400
commit26da7ec9f535205f9a6b102380087a1383c092c3 (patch)
treed3b24c6f737b1c063af390d3d05ff9ae917c89ea /mesonbuild
parent1a9f20d44a3c88882e5744d6179926f3f179cc8d (diff)
downloadmeson-26da7ec9f535205f9a6b102380087a1383c092c3.zip
meson-26da7ec9f535205f9a6b102380087a1383c092c3.tar.gz
meson-26da7ec9f535205f9a6b102380087a1383c092c3.tar.bz2
python: Use detect.find_external_dependency() for log consistency
py.find_installation().dependency() was not logging whether it is found or not. Use find_external_dependency() for consistency.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/dependencies/detect.py5
-rw-r--r--mesonbuild/modules/python.py10
2 files changed, 6 insertions, 9 deletions
diff --git a/mesonbuild/dependencies/detect.py b/mesonbuild/dependencies/detect.py
index 4c7a477..b5c9251 100644
--- a/mesonbuild/dependencies/detect.py
+++ b/mesonbuild/dependencies/detect.py
@@ -80,7 +80,7 @@ display_name_map = {
'wxwidgets': 'WxWidgets',
}
-def find_external_dependency(name: str, env: 'Environment', kwargs: T.Dict[str, object]) -> T.Union['ExternalDependency', NotFoundDependency]:
+def find_external_dependency(name: str, env: 'Environment', kwargs: T.Dict[str, object], candidates: T.Optional[T.List['DependencyGenerator']] = None) -> T.Union['ExternalDependency', NotFoundDependency]:
assert name
required = kwargs.get('required', True)
if not isinstance(required, bool):
@@ -101,7 +101,8 @@ def find_external_dependency(name: str, env: 'Environment', kwargs: T.Dict[str,
type_text = PerMachine('Build-time', 'Run-time')[for_machine] + ' dependency'
# build a list of dependency methods to try
- candidates = _build_external_dependency_list(name, env, for_machine, kwargs)
+ if candidates is None:
+ candidates = _build_external_dependency_list(name, env, for_machine, kwargs)
pkg_exc: T.List[DependencyException] = []
pkgdep: T.List[ExternalDependency] = []
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index 8588c4c..ac74e13 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -22,7 +22,7 @@ from .. import mlog
from ..coredata import UserFeatureOption
from ..build import known_shmod_kwargs
from ..dependencies import NotFoundDependency
-from ..dependencies.detect import get_dep_identifier
+from ..dependencies.detect import get_dep_identifier, find_external_dependency
from ..dependencies.python import BasicPythonExternalProgram, python_factory, _PythonDependencyBase
from ..interpreter import ExternalProgramHolder, extract_required_kwarg, permitted_dependency_kwargs
from ..interpreter import primitives as P_OBJ
@@ -185,12 +185,8 @@ class PythonInstallation(ExternalProgramHolder):
new_kwargs = kwargs.copy()
new_kwargs['required'] = False
- # it's theoretically (though not practically) possible to not bind dep, let's ensure it is.
- dep: Dependency = NotFoundDependency('python', self.interpreter.environment)
- for d in python_factory(self.interpreter.environment, for_machine, new_kwargs, self.held_object):
- dep = d()
- if dep.found():
- break
+ candidates = python_factory(self.interpreter.environment, for_machine, new_kwargs, self.held_object)
+ dep = find_external_dependency('python', self.interpreter.environment, new_kwargs, candidates)
self.interpreter.coredata.deps[for_machine].put(identifier, dep)
return dep