Encapsulate main into a function
This commit is contained in:
parent
d57adee92c
commit
c2d15ea593
1 changed files with 7 additions and 1 deletions
|
@ -1774,7 +1774,8 @@ def signal_handler(sig, frame):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def main():
|
||||||
|
"""The main function."""
|
||||||
signal.signal(signal.SIGINT, signal_handler)
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
signal.signal(signal.SIGUSR1, signal_handler)
|
signal.signal(signal.SIGUSR1, signal_handler)
|
||||||
editor = None
|
editor = None
|
||||||
|
@ -1841,6 +1842,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
pkg_state = {}
|
pkg_state = {}
|
||||||
other_state = {}
|
other_state = {}
|
||||||
|
global PKG_STATE, OTHER_STATE
|
||||||
PKG_STATE = pkg_state
|
PKG_STATE = pkg_state
|
||||||
OTHER_STATE = other_state
|
OTHER_STATE = other_state
|
||||||
other_state["USER"] = os.environ["USER"]
|
other_state["USER"] = os.environ["USER"]
|
||||||
|
@ -2307,3 +2309,7 @@ if __name__ == "__main__":
|
||||||
log_print("Canceled.", other_state=other_state)
|
log_print("Canceled.", other_state=other_state)
|
||||||
else:
|
else:
|
||||||
log_print("No packages to update, done.", other_state=other_state)
|
log_print("No packages to update, done.", other_state=other_state)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
Loading…
Reference in a new issue