SCons: Validate dependencies for linked multimedia modules

This is still a bit hacky and eventually we should rework the way we handle
optional dependencies (especially with regard to builtin/system libs), but
it's a simple first step.

Fixes #39219.
This commit is contained in:
Rémi Verschelde 2020-06-02 13:16:42 +02:00
parent 030a26206f
commit 7c74312217
6 changed files with 38 additions and 12 deletions

View file

@ -231,6 +231,30 @@ def disable_module(self):
self.disabled_modules.append(self.current_module)
def module_check_dependencies(self, module, dependencies):
"""
Checks if module dependencies are enabled for a given module,
and prints a warning if they aren't.
Meant to be used in module `can_build` methods.
Returns a boolean (True if dependencies are satisfied).
"""
missing_deps = []
for dep in dependencies:
opt = "module_{}_enabled".format(dep)
if not opt in self or not self[opt]:
missing_deps.append(dep)
if missing_deps != []:
print(
"Disabling '{}' module as the following dependencies are not satisfied: {}".format(
module, ", ".join(missing_deps)
)
)
return False
else:
return True
def use_windows_spawn_fix(self, platform=None):
if os.name != "nt":