Refactor pkg state printing

This commit is contained in:
Stephen Seo 2024-04-25 16:43:35 +09:00
parent f2ca2a047d
commit b9b0cf3399

View file

@ -1757,12 +1757,9 @@ def print_state_info_and_get_update_list(
for pkg_name, pkg_dict in pkg_state.items(): for pkg_name, pkg_dict in pkg_state.items():
name_space = " " * (max_name_len - len(pkg_name)) name_space = " " * (max_name_len - len(pkg_name))
if "state" in pkg_dict: if "state" in pkg_dict:
state_length = 15 - len(pkg_dict["state"]) state_str = '"' + pkg_dict["state"] + '"'
if state_length <= 0:
state_length = 1
space_str = " " * state_length
log_print( log_print(
f" {pkg_name}{name_space}: pre_state is \"{pkg_dict['state']}\",{space_str}build_state is \"{pkg_dict['build_status']}\"", f" {pkg_name}{name_space}: pre_state is {state_str: <13}, build_state is \"{pkg_dict['build_status']}\"",
other_state=other_state, other_state=other_state,
) )
if pkg_dict["state"] == "install": if pkg_dict["state"] == "install":
@ -2507,7 +2504,7 @@ def main():
pkg_list[i], pkg_list[i],
other_state=other_state, other_state=other_state,
) )
pkg_state[pkg_list[i]]["state"] = "error_fetching" pkg_state[pkg_list[i]]["state"] = "error_fetch"
pkg_state[pkg_list[i]]["build_status"] = "not_building" pkg_state[pkg_list[i]]["build_status"] = "not_building"
i += 1 i += 1
continue continue