aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-12-27 14:44:24 -0500
committerXavier Claessens <xclaesse@gmail.com>2019-01-16 11:16:46 -0500
commita92b41fdcd0691c2efc8222be1cb8d3ea1c29aa7 (patch)
tree8e15ec40983ef01ddba72f8a034469ea47d4f86e /mesonbuild/interpreter.py
parent2f72d4db0921ec3ce7c4cd9803c7af9f4ac776cf (diff)
downloadmeson-a92b41fdcd0691c2efc8222be1cb8d3ea1c29aa7.zip
meson-a92b41fdcd0691c2efc8222be1cb8d3ea1c29aa7.tar.gz
meson-a92b41fdcd0691c2efc8222be1cb8d3ea1c29aa7.tar.bz2
dependencies: Remove version from cache key
We cannot have 2 different versions with all other kwargs being identical. This simplifies a lot that code.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py38
1 files changed, 17 insertions, 21 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 125d2cf..1963d3c 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2851,28 +2851,24 @@ external dependencies (including libraries) must go to "dependencies".''')
want_cross = not kwargs['native']
else:
want_cross = is_cross
+
identifier = dependencies.get_dep_identifier(name, kwargs, want_cross)
- cached_dep = None
- # Check if we've already searched for and found this dep
- if identifier in self.coredata.deps:
- cached_dep = self.coredata.deps[identifier]
- mlog.log('Dependency', mlog.bold(name),
- 'found:', mlog.green('YES'), '(cached)')
- else:
- # Check if exactly the same dep with different version requirements
- # was found already.
- wanted = identifier[1]
- for trial, trial_dep in self.coredata.deps.items():
- # trial[1], identifier[1] are the version requirements
- if trial[0] != identifier[0] or trial[2:] != identifier[2:]:
- continue
- found = trial_dep.get_version()
- if not wanted or mesonlib.version_compare_many(found, wanted)[0]:
- # We either don't care about the version, or our
- # version requirements matched the trial dep's version.
- cached_dep = trial_dep
- break
- return identifier, cached_dep
+ cached_dep = self.coredata.deps.get(identifier)
+ if cached_dep:
+ if not cached_dep.found():
+ mlog.log('Dependency', mlog.bold(name),
+ 'found:', mlog.red('NO'), '(cached)')
+ return identifier, cached_dep
+
+ # Verify the cached dep version match
+ wanted = kwargs.get('version', [])
+ found = cached_dep.get_version()
+ if not wanted or mesonlib.version_compare_many(found, wanted)[0]:
+ mlog.log('Dependency', mlog.bold(name),
+ 'found:', mlog.green('YES'), '(cached)')
+ return identifier, cached_dep
+
+ return identifier, None
@staticmethod
def check_subproject_version(wanted, found):