]> git.seodisparate.com - AnotherAURHelper/commitdiff
More robust status print ending build step
authorStephen Seo <seo.disparate@gmail.com>
Fri, 17 Nov 2023 11:32:12 +0000 (20:32 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Fri, 17 Nov 2023 11:32:12 +0000 (20:32 +0900)
update.py

index f38354e64907cdebd4ade8b4f1e64896c9b7ede3..d270c14b25c219b88364252fd8ea0561356f8417 100755 (executable)
--- a/update.py
+++ b/update.py
@@ -1203,6 +1203,8 @@ def update_pkg_list(
     """For each package to build: builds it, signs it, and moves it to
     "pkg_out_dir"."""
 
+    atexit.register(build_print_pkg_info, pkgs, other_state)
+
     if not get_sudo_privileges():
         log_print(
             "ERROR: Failed to get sudo privileges", other_state=other_state
@@ -1559,17 +1561,6 @@ def update_pkg_list(
                     ),
                 )
 
-    max_name_len = 1
-    for pkg in pkgs:
-        if len(pkg) + 1 > max_name_len:
-            max_name_len = len(pkg) + 1
-    for pkg in pkgs:
-        name_space = " " * (max_name_len - len(pkg))
-        log_print(
-            f'"{pkg}"{name_space}status: {pkg_state[pkg]["build_status"]}',
-            other_state=other_state,
-        )
-
 
 def get_latest_pkg(pkg: str, cache_dir: str):
     """Gets the latest pkg from the specified "cache_dir" and return its
@@ -1656,6 +1647,20 @@ def print_state_info_and_get_update_list(
     return to_update
 
 
+def build_print_pkg_info(pkgs: tuple[str], other_state: dict[str, any]):
+    """Prints the current "build" state of the given pkgs."""
+    max_name_len = 1
+    for pkg in pkgs:
+        if len(pkg) + 1 > max_name_len:
+            max_name_len = len(pkg) + 1
+    for pkg in pkgs:
+        name_space = " " * (max_name_len - len(pkg))
+        log_print(
+            f'"{pkg}"{name_space}status: {pkg_state[pkg]["build_status"]}',
+            other_state=other_state,
+        )
+
+
 def test_gpg_passphrase(
     signing_gpg_dir: str, signing_key_fp: str, passphrase: str
 ):