diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-05-07 02:01:41 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-05-09 14:23:15 +0530 |
commit | c7d71c79434d98c280121ac1a20faca8fd512e40 (patch) | |
tree | 14fa2b546a8331fb55dc1aa436dacd49a64c7eb5 /mesonbuild/interpreter.py | |
parent | bf54383d8aabd076a5893a3e849fd6788db77054 (diff) | |
download | meson-c7d71c79434d98c280121ac1a20faca8fd512e40.zip meson-c7d71c79434d98c280121ac1a20faca8fd512e40.tar.gz meson-c7d71c79434d98c280121ac1a20faca8fd512e40.tar.bz2 |
dependencies: Fix caching of native/cross dependencies
All our cached_dep magic was totally useless since we ended up using
the same identifier for native and cross deps. Just nuke all this
cached_dep code since it is very error-prone and improve the
identifier generation instead.
For instance, this is broken *right now* with the `type_name` kwarg.
Add a bunch of tests to ensure that all this actually works...
Closes https://github.com/mesonbuild/meson/issues/1736
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 80d482e..886f200 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1858,7 +1858,6 @@ class Interpreter(InterpreterBase): if '<' in name or '>' in name or '=' in name: raise InvalidArguments('Characters <, > and = are forbidden in dependency names. To specify' 'version\n requirements use the \'version\' keyword argument instead.') - identifier = dependencies.get_dep_identifier(name, kwargs) # Check if we want this as a cross-dep or a native-dep # FIXME: Not all dependencies support such a distinction right now, # and we repeat this check inside dependencies that do. We need to @@ -1868,10 +1867,14 @@ class Interpreter(InterpreterBase): want_cross = not kwargs['native'] else: want_cross = is_cross + identifier = dependencies.get_dep_identifier(name, kwargs, want_cross) # Check if we've already searched for and found this dep cached_dep = None if identifier in self.coredata.deps: cached_dep = self.coredata.deps[identifier] + # All other kwargs are handled in get_dep_identifier(). We have + # this here as a tiny optimization to avoid searching for + # dependencies that we already have. if 'version' in kwargs: wanted = kwargs['version'] found = cached_dep.get_version() @@ -1880,13 +1883,6 @@ class Interpreter(InterpreterBase): # Cached dep has the wrong version. Check if an external # dependency or a fallback dependency provides it. cached_dep = None - # Don't re-use cached dep if it wasn't required but this one is, - # so we properly go into fallback/error code paths - if kwargs.get('required', True) and not getattr(cached_dep, 'required', False): - cached_dep = None - # Don't reuse cached dep if one is a cross-dep and the other is a native dep - if not getattr(cached_dep, 'want_cross', is_cross) == want_cross: - cached_dep = None if cached_dep: dep = cached_dep |