aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-06-28 12:00:40 -0400
committerXavier Claessens <xavier.claessens@collabora.com>2022-10-09 13:04:04 -0400
commit39d825fabfde54268b990aaec23539800c95ca89 (patch)
tree7d48ea0aa35cc4f1ebbe595108d9aecf844cfc88
parentced9efb5793ff932a0132e79378ded4e393c200d (diff)
downloadmeson-39d825fabfde54268b990aaec23539800c95ca89.zip
meson-39d825fabfde54268b990aaec23539800c95ca89.tar.gz
meson-39d825fabfde54268b990aaec23539800c95ca89.tar.bz2
Get fallback varname from wrap file after it has been configured
When _subproject_impl() is called the wrap file could not have been downloaded form wrapdb yet, it is done when fetching the subproject. Delay getting the variable name to when we actually need it, at that point we are sure the wrap file has been downloaded.
-rw-r--r--mesonbuild/interpreter/dependencyfallbacks.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/mesonbuild/interpreter/dependencyfallbacks.py b/mesonbuild/interpreter/dependencyfallbacks.py
index 3fbce42..54be990 100644
--- a/mesonbuild/interpreter/dependencyfallbacks.py
+++ b/mesonbuild/interpreter/dependencyfallbacks.py
@@ -66,14 +66,6 @@ class DependencyFallbacksHolder(MesonInterpreterObject):
self._subproject_impl(subp_name, varname)
def _subproject_impl(self, subp_name: str, varname: str) -> None:
- if not varname:
- # If no variable name is specified, check if the wrap file has one.
- # If the wrap file has a variable name, better use it because the
- # subproject most probably is not using meson.override_dependency().
- for name in self.names:
- varname = self.wrap_resolver.get_varname(subp_name, name)
- if varname:
- break
assert self.subproject_name is None
self.subproject_name = subp_name
self.subproject_varname = varname
@@ -175,6 +167,14 @@ class DependencyFallbacksHolder(MesonInterpreterObject):
# Legacy: Use the variable name if provided instead of relying on the
# subproject to override one of our dependency names
if not varname:
+ # If no variable name is specified, check if the wrap file has one.
+ # If the wrap file has a variable name, better use it because the
+ # subproject most probably is not using meson.override_dependency().
+ for name in self.names:
+ varname = self.wrap_resolver.get_varname(subp_name, name)
+ if varname:
+ break
+ if not varname:
mlog.warning(f'Subproject {subp_name!r} did not override {self._display_name!r} dependency and no variable name specified')
mlog.log('Dependency', mlog.bold(self._display_name), 'from subproject',
mlog.bold(subproject.subdir), 'found:', mlog.red('NO'))