Formatting

This commit is contained in:
Stephen Seo 2024-09-04 15:49:19 +09:00
parent 666557172d
commit 9701fff991

View file

@ -1758,12 +1758,15 @@ def print_state_info_and_get_update_list(
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_str = '"' + pkg_dict["state"] + '"' state_str = '"' + pkg_dict["state"] + '"'
if ("print_state_SIGUSR1" in other_state if (
and type(other_state["print_state_SIGUSR1"]) is bool "print_state_SIGUSR1" in other_state
and other_state["print_state_SIGUSR1"] and type(other_state["print_state_SIGUSR1"]) is bool
and "print_state_info_only_building_sigusr1" in other_state and other_state["print_state_SIGUSR1"]
and type(other_state["print_state_info_only_building_sigusr1"]) is bool and "print_state_info_only_building_sigusr1" in other_state
and other_state["print_state_info_only_building_sigusr1"]): and type(other_state["print_state_info_only_building_sigusr1"])
is bool
and other_state["print_state_info_only_building_sigusr1"]
):
if state_str == '"install"': if state_str == '"install"':
log_print( log_print(
f" {pkg_name}{name_space}: pre_state is {state_str: <13}, 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']}\"",
@ -1907,7 +1910,9 @@ def signal_handler(sig, frame):
"""Handle SIGINT and SIGUSR1.""" """Handle SIGINT and SIGUSR1."""
global OTHER_STATE, PKG_STATE global OTHER_STATE, PKG_STATE
if OTHER_STATE is not None and PKG_STATE is not None: if OTHER_STATE is not None and PKG_STATE is not None:
OTHER_STATE["print_state_SIGUSR1"] = signal.Signals(sig) is signal.SIGUSR1 OTHER_STATE["print_state_SIGUSR1"] = (
signal.Signals(sig) is signal.SIGUSR1
)
print_state_info_and_get_update_list(OTHER_STATE, PKG_STATE) print_state_info_and_get_update_list(OTHER_STATE, PKG_STATE)
OTHER_STATE["print_state_SIGUSR1"] = False OTHER_STATE["print_state_SIGUSR1"] = False
if signal.Signals(sig) is not signal.SIGINT: if signal.Signals(sig) is not signal.SIGINT:
@ -2356,13 +2361,18 @@ def main():
other_state["tmpfs"] = True other_state["tmpfs"] = True
else: else:
other_state["tmpfs"] = False other_state["tmpfs"] = False
if ("print_state_info_only_building_sigusr1" in d if (
and type(d["print_state_info_only_building_sigusr1"]) is bool): "print_state_info_only_building_sigusr1" in d
other_state["print_state_info_only_building_sigusr1"] = \ and type(d["print_state_info_only_building_sigusr1"]) is bool
d["print_state_info_only_building_sigusr1"] ):
print("State info print on SIGUSR1 is set to: \"{}\"".format( other_state["print_state_info_only_building_sigusr1"] = d[
other_state["print_state_info_only_building_sigusr1"] "print_state_info_only_building_sigusr1"
)) ]
print(
'State info print on SIGUSR1 is set to: "{}"'.format(
other_state["print_state_info_only_building_sigusr1"]
)
)
else: else:
log_print( log_print(
'ERROR: At least "--config" or "--pkg" must be specified', 'ERROR: At least "--config" or "--pkg" must be specified',