summaryrefslogtreecommitdiffstats
path: root/methods.py
diff options
context:
space:
mode:
authorYevhen Babiichuk (DustDFG) <dfgdust@gmail.com>2024-10-04 16:21:33 +0300
committerYevhen Babiichuk (DustDFG) <dfgdust@gmail.com>2024-10-23 08:26:22 +0300
commit8e75e029b304e281bc811d6a4e06dd856e7139bd (patch)
tree1da236fb20cb045875edc3bd402f23bb6a2fbb4a /methods.py
parent533c616cb86ff7bb940d58ffbbcc1a3eca0aa33d (diff)
downloadredot-engine-8e75e029b304e281bc811d6a4e06dd856e7139bd.tar.gz
Make module dependency check recursive
The `env.disabled_modules` and `methods.disable_module` weren't used anywhere so the first one was repurposed and the second just deleted Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
Diffstat (limited to 'methods.py')
-rw-r--r--methods.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/methods.py b/methods.py
index 9e881773c9..65b88a5c65 100644
--- a/methods.py
+++ b/methods.py
@@ -404,10 +404,6 @@ def convert_custom_modules_path(path):
return path
-def disable_module(self):
- self.disabled_modules.append(self.current_module)
-
-
def module_add_dependencies(self, module, dependencies, optional=False):
"""
Adds dependencies for a given module.
@@ -428,19 +424,21 @@ def module_check_dependencies(self, module):
Meant to be used in module `can_build` methods.
Returns a boolean (True if dependencies are satisfied).
"""
- missing_deps = []
+ missing_deps = set()
required_deps = self.module_dependencies[module][0] if module in self.module_dependencies else []
for dep in required_deps:
opt = "module_{}_enabled".format(dep)
- if opt not in self or not self[opt]:
- missing_deps.append(dep)
-
- if missing_deps != []:
- print_warning(
- "Disabling '{}' module as the following dependencies are not satisfied: {}".format(
- module, ", ".join(missing_deps)
+ if opt not in self or not self[opt] or not module_check_dependencies(self, dep):
+ missing_deps.add(dep)
+
+ if missing_deps:
+ if module not in self.disabled_modules:
+ print_warning(
+ "Disabling '{}' module as the following dependencies are not satisfied: {}".format(
+ module, ", ".join(missing_deps)
+ )
)
- )
+ self.disabled_modules.add(module)
return False
else:
return True