interpretor: Correctly check the version of a fallback dependency

Previously the check was always done with the project version--which is wrong.
It should always check against the version of the dependency requested.
pull/573/head
Nirbheek Chauhan 9 years ago
parent acdd4bd523
commit 0096c51035
  1. 12
      mesonbuild/interpreter.py

@ -1639,8 +1639,16 @@ class Interpreter():
if len(fbinfo) != 2:
raise InterpreterException('Fallback info must have exactly two items.')
dirname, varname = fbinfo
self.do_subproject(dirname, kwargs)
return self.subprojects[dirname].get_variable_method([varname], {})
self.do_subproject(dirname, {})
dep = self.subprojects[dirname].get_variable_method([varname], {})
# Check if the version of the declared dependency matches what we want
if 'version' in kwargs:
wanted = kwargs['version']
found = dep.version_method([], {})
if found == 'undefined' or not mesonlib.version_compare(found, wanted):
m = 'Subproject "{0}" dependency "{1}" version is "{2}" but "{3}" is required.'
raise InterpreterException(m.format(dirname, varname, found, wanted))
return dep
def func_executable(self, node, args, kwargs):
return self.build_target(node, args, kwargs, ExecutableHolder)

Loading…
Cancel
Save