subproject handling: add fix

pull/2581/head
Niklas Claesson 7 years ago
parent d1d2aa2213
commit ba161d42ee
  1. 10
      mesonbuild/interpreter.py

@ -2172,7 +2172,17 @@ to directly access options of other subprojects.''')
# a higher level project, try to use it first.
if 'fallback' in kwargs:
dirname, varname = self.get_subproject_infos(kwargs)
required = kwargs.get('required', True)
wanted = kwargs.get('version', 'undefined')
if not isinstance(required, bool):
raise DependencyException('Keyword "required" must be a boolean.')
if dirname in self.subprojects:
found = self.subprojects[dirname].held_object.project_version
valid_version = wanted == 'undefined' or mesonlib.version_compare(found, wanted)
if required and not valid_version:
m = 'Version {} of {} already loaded, requested incompatible version {}'
raise DependencyException(m.format(found, dirname, wanted))
elif valid_version:
subproject = self.subprojects[dirname]
try:
# Never add fallback deps to self.coredata.deps

Loading…
Cancel
Save