[sdk/kde-builder] kde_builder_lib: refactor: Extract module.install() outside of module.build()

Andrew Shark <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 4ff6152b0721e9a4ca9772a1e7c312ea09de6531 by Andrew Shark.
Committed on 25/07/2026 at 19:29.
Pushed by ashark into branch 'master'.

refactor: Extract module.install() outside of module.build()

M  +2    -14   kde_builder_lib/module/module.py
M  +19   -3    kde_builder_lib/task_manager.py

https://invent.kde.org/sdk/kde-builder/-/commit/4ff6152b0721e9a4ca9772a1e7c312ea09de6531

diff --git a/kde_builder_lib/module/module.py b/kde_builder_lib/module/module.py
index dca9eb35..35b08331 100644
--- a/kde_builder_lib/module/module.py
+++ b/kde_builder_lib/module/module.py
@@ -230,7 +230,7 @@ class Module(OptionsBase):
 
     def build(self) -> bool:
         """
-        Execute the build and install (or pretends to in pretend mode) using the appropriate build system. Can also run the testsuite as part of the build.
+        Execute the build (or pretends to in pretend mode) using the appropriate build system. Can also run the testsuite as part of the build.
 
         Returns:
              False on failure, True on success.
@@ -255,19 +255,7 @@ class Module(OptionsBase):
         if self.get_option("run-tests"):
             self.build_system.run_testsuite()
 
-        if not self.phases.has("install"):
-            logger_module.info("\tSkipping install due to disabled install phase.")
-            return True
-
-        # Clear the progress values after build process, so they do not influence on initial progress of install process.
-        # This is needed because currently the install() is invoked from build().
-        sv = self.context.status_view
-        sv.current_project_cur_progress = -1
-        sv.current_project_full_progress = -1
-        sv.status = ""
-
-        # TODO: this should be a phase to run.
-        return self.install()
+        return True
 
     def setup_build_system(self) -> bool:
         """
diff --git a/kde_builder_lib/task_manager.py b/kde_builder_lib/task_manager.py
index c21cb46e..9c015212 100644
--- a/kde_builder_lib/task_manager.py
+++ b/kde_builder_lib/task_manager.py
@@ -235,10 +235,26 @@ class TaskManager:
         # value to write. If the build succeeds we'll reset to 0 then.
         module.set_persistent_option("failure-count", fail_count + 1)
 
-        if module.build():
+        if not module.build():
+            return "build"  # phase failed at
+
+        if not module.phases.has("install"):
+            logger_taskmanager.info("\tSkipping install due to disabled install phase.")
             module.set_persistent_option("failure-count", 0)
             return ""
-        return "build"  # phase failed at
+
+        # Clear the progress values after build process, so they do not influence on initial progress of install process.
+        # This is needed because the install() is invoked after build().
+        sv = module.context.status_view
+        sv.current_project_cur_progress = -1
+        sv.current_project_full_progress = -1
+        sv.status = ""
+
+        if not module.install():
+            return "install"  # phase failed at
+
+        module.set_persistent_option("failure-count", 0)
+        return ""
 
     def _handle_build(self, ipc: IPC, ctx: BuildContext) -> int:
         """
@@ -329,7 +345,7 @@ class TaskManager:
                 # FAILURE
                 ctx.mark_module_phase_failed(failed_phase, module)
                 print(f"{module.name}: Failed to {failed_phase}.", file=status_list_fh)
-                if failed_phase == "build":
+                if failed_phase == "build" or failed_phase == "install":
                     print(module.name, file=failed_to_build_fh)
                 if failed_phase == "update":
                     print(module.name, file=failed_to_update_fh)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.