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/dependencies.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/dependencies.py')
-rw-r--r-- | mesonbuild/dependencies.py | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py index 37e2cbd..2267492 100644 --- a/mesonbuild/dependencies.py +++ b/mesonbuild/dependencies.py @@ -1742,21 +1742,17 @@ class LLVMDependency(Dependency): return True -def get_dep_identifier(name, kwargs): - elements = [name] - modlist = kwargs.get('modules', []) - if isinstance(modlist, str): - modlist = [modlist] - for module in modlist: - elements.append(module) - # We use a tuple because we need a non-mutable structure to use as the key - # of a dictionary and a string has potential for name collisions - identifier = tuple(elements) - identifier += ('main', kwargs.get('main', False)) - identifier += ('static', kwargs.get('static', False)) - if 'fallback' in kwargs: - f = kwargs.get('fallback') - identifier += ('fallback', f[0], f[1]) +def get_dep_identifier(name, kwargs, want_cross): + # Need immutable objects since the identifier will be used as a dict key + identifier = (name, want_cross) + for key, value in kwargs.items(): + # Ignore versions, they will be handled by the caller + if key == 'version': + continue + # All keyword arguments are strings, ints, or lists (or lists of lists) + if isinstance(value, list): + value = frozenset(mesonlib.flatten(value)) + identifier += (key, value) return identifier def find_external_dependency(name, environment, kwargs): |