[sdk/kde-builder] kde_builder_lib: refactor: Move _yield_module_dependency_tree_entry to DependencyResolver class
Andrew Shark <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 3505e3e7ec7e2ba5de78f8cf64ac3127ff14bbea by Andrew Shark.
Committed on 16/07/2026 at 20:33.
Pushed by ashark into branch 'master'.
refactor: Move _yield_module_dependency_tree_entry to DependencyResolver class
M +2 -55 kde_builder_lib/application.py
M +53 -0 kde_builder_lib/dependency_resolver.py
https://invent.kde.org/sdk/kde-builder/-/commit/3505e3e7ec7e2ba5de78f8cf64ac3127ff14bbea
diff --git a/kde_builder_lib/application.py b/kde_builder_lib/application.py
index 6ae7a7c8..43654422 100644
--- a/kde_builder_lib/application.py
+++ b/kde_builder_lib/application.py
@@ -156,59 +156,6 @@ class Application:
self._install_signal_handlers(signal_handler)
- @staticmethod
- def _yield_module_dependency_tree_entry(node_info: dict, module: Module, context: dict) -> None:
- depth = node_info["depth"]
- index = node_info["idx"]
- count = node_info["count"]
- build = node_info["build"]
- current_item = node_info["current_item"]
- current_branch = node_info["current_branch"]
-
- build_status = "built" if build else "not built"
- status_info = f"({build_status}: {current_branch})" if current_branch else f"({build_status})"
-
- connector_stack = context["stack"]
-
- prefix = connector_stack.pop()
-
- while context["depth"] > depth:
- prefix = connector_stack.pop()
- context["depth"] -= 1
-
- connector_stack.append(prefix)
-
- if depth == 0:
- connector = prefix + " ── "
- connector_stack.append(prefix + (" " * 4))
- else:
- connector = prefix + ("└── " if index == count else "├── ")
- connector_stack.append(prefix + (" " * 4 if index == count else "│ "))
-
- context["depth"] = depth + 1
- context["report"](connector + current_item + " " + status_info)
-
- @staticmethod
- def _yield_module_dependency_tree_entry_full_path(node_info: dict, module: Module, context: dict) -> None:
- depth = node_info["depth"]
- current_item = node_info["current_item"]
-
- connector_stack = context["stack"]
-
- prefix = connector_stack.pop()
-
- while context["depth"] > depth:
- prefix = connector_stack.pop()
- context["depth"] -= 1
-
- connector_stack.append(prefix)
-
- connector = prefix
- connector_stack.append(prefix + current_item + "/")
-
- context["depth"] = depth + 1
- context["report"](connector + current_item)
-
def generate_module_list(self) -> None:
"""
Generate the build context and module list based on the command line options and module command line selectors provided.
@@ -394,9 +341,9 @@ class Application:
if "dependency-tree" in cmdline_global_options or "dependency-tree-fullpath" in cmdline_global_options:
if "dependency-tree" in cmdline_global_options:
- callback = self._yield_module_dependency_tree_entry
+ callback = self.dependency_resolver._yield_module_dependency_tree_entry
else:
- callback = self._yield_module_dependency_tree_entry_full_path
+ callback = self.dependency_resolver._yield_module_dependency_tree_entry_full_path
self.dependency_resolver.walk_module_dependency_trees(
callback,
diff --git a/kde_builder_lib/dependency_resolver.py b/kde_builder_lib/dependency_resolver.py
index 8ed9cda1..efbe4333 100644
--- a/kde_builder_lib/dependency_resolver.py
+++ b/kde_builder_lib/dependency_resolver.py
@@ -681,3 +681,56 @@ class DependencyResolver:
if ref_type == "branch":
return ref_value
return None
+
+ @staticmethod
+ def _yield_module_dependency_tree_entry(node_info: dict, module: Module, context: dict) -> None:
+ depth = node_info["depth"]
+ index = node_info["idx"]
+ count = node_info["count"]
+ build = node_info["build"]
+ current_item = node_info["current_item"]
+ current_branch = node_info["current_branch"]
+
+ build_status = "built" if build else "not built"
+ status_info = f"({build_status}: {current_branch})" if current_branch else f"({build_status})"
+
+ connector_stack = context["stack"]
+
+ prefix = connector_stack.pop()
+
+ while context["depth"] > depth:
+ prefix = connector_stack.pop()
+ context["depth"] -= 1
+
+ connector_stack.append(prefix)
+
+ if depth == 0:
+ connector = prefix + " ── "
+ connector_stack.append(prefix + (" " * 4))
+ else:
+ connector = prefix + ("└── " if index == count else "├── ")
+ connector_stack.append(prefix + (" " * 4 if index == count else "│ "))
+
+ context["depth"] = depth + 1
+ context["report"](connector + current_item + " " + status_info)
+
+ @staticmethod
+ def _yield_module_dependency_tree_entry_full_path(node_info: dict, module: Module, context: dict) -> None:
+ depth = node_info["depth"]
+ current_item = node_info["current_item"]
+
+ connector_stack = context["stack"]
+
+ prefix = connector_stack.pop()
+
+ while context["depth"] > depth:
+ prefix = connector_stack.pop()
+ context["depth"] -= 1
+
+ connector_stack.append(prefix)
+
+ connector = prefix
+ connector_stack.append(prefix + current_item + "/")
+
+ context["depth"] = depth + 1
+ context["report"](connector + current_item)