From 9d9006c9605ea0f09b66865c6d90b4ee8153dcd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Fri, 19 Apr 2024 22:30:57 +0200 Subject: [PATCH] interpreter: Fix dependency(..., modules: x) fallback Where the subproject got registered without modules, but is later looked up with modules specified. We cannot do the filtering in get_dep_identifier(), as the list of modules matters in case of external dependencies. --- mesonbuild/interpreter/dependencyfallbacks.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mesonbuild/interpreter/dependencyfallbacks.py b/mesonbuild/interpreter/dependencyfallbacks.py index eca6a2c71796..7df9b7f18277 100644 --- a/mesonbuild/interpreter/dependencyfallbacks.py +++ b/mesonbuild/interpreter/dependencyfallbacks.py @@ -209,6 +209,10 @@ def _get_cached_dep(self, name: str, kwargs: TYPE_nkwargs) -> T.Optional[Depende wanted_vers = stringlistify(kwargs.get('version', [])) override = self.build.dependency_overrides[for_machine].get(identifier) + if not override and self.subproject_name: + identifier_without_modules = tuple((k, v) for k, v in identifier if k not in {'modules', 'optional_modules'}) + if identifier_without_modules != identifier: + override = self.build.dependency_overrides[for_machine].get(identifier_without_modules) if override: info = [mlog.blue('(overridden)' if override.explicit else '(cached)')] cached_dep = override.dep