mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-02-24 23:07:36 +08:00
WIP
This commit is contained in:
parent
1f25fdde2f
commit
b2d8d49495
1 changed files with 19 additions and 20 deletions
39
bazarr.py
39
bazarr.py
|
@ -1,7 +1,7 @@
|
|||
# coding=utf-8
|
||||
|
||||
import bazarr.libs
|
||||
import os
|
||||
import platform
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -15,14 +15,13 @@ def check_python_version():
|
|||
minimum_py3_tuple = (3, 7, 0)
|
||||
minimum_py3_str = ".".join(str(i) for i in minimum_py3_tuple)
|
||||
|
||||
if int(python_version[0]) < 3:
|
||||
print("Python " + minimum_py3_str + " or greater required. "
|
||||
"Current version is " + platform.python_version() + ". Please upgrade Python.")
|
||||
if int(python_version[0]) < minimum_py3_tuple[0]:
|
||||
print("Python " + minimum_py3_str + " or greater required. Current version is " + platform.python_version() +
|
||||
". Please upgrade Python.")
|
||||
sys.exit(1)
|
||||
elif (int(python_version[0]) == minimum_py3_tuple[0] and int(python_version[1]) < minimum_py3_tuple[1]) or \
|
||||
(int(python_version[0]) != minimum_py3_tuple[0] and int(python_version[0]) != minimum_py2_tuple[0]):
|
||||
print("Python " + minimum_py3_str + " or greater required. "
|
||||
"Current version is " + platform.python_version() + ". Please upgrade Python.")
|
||||
elif int(python_version[1]) < minimum_py3_tuple[1]:
|
||||
print("Python " + minimum_py3_str + " or greater required. Current version is " + platform.python_version() +
|
||||
". Please upgrade Python.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
@ -137,19 +136,19 @@ if __name__ == '__main__':
|
|||
|
||||
daemonStatus = DaemonStatus()
|
||||
|
||||
def force_shutdown():
|
||||
# force the killing of children processes
|
||||
daemonStatus.force_stop()
|
||||
# if a new SIGTERM signal is caught the standard behaviour should be followed
|
||||
signal.signal(signal.SIGTERM, signal.SIG_DFL)
|
||||
# emulate a Ctrl C command on itself (bypasses the signal thing but, then, emulates the "Ctrl+C break")
|
||||
os.kill(os.getpid(), signal.SIGINT)
|
||||
def force_shutdown():
|
||||
# force the killing of children processes
|
||||
daemonStatus.force_stop()
|
||||
# if a new SIGTERM signal is caught the standard behaviour should be followed
|
||||
signal.signal(signal.SIGTERM, signal.SIG_DFL)
|
||||
# emulate a Ctrl C command on itself (bypasses the signal thing but, then, emulates the "Ctrl+C break")
|
||||
os.kill(os.getpid(), signal.SIGINT)
|
||||
|
||||
def shutdown():
|
||||
# indicates that everything should stop
|
||||
daemonStatus.stop()
|
||||
# if a new sigterm signal is caught it should force the shutdown of children processes
|
||||
signal.signal(signal.SIGTERM, lambda signal_no, frame: force_shutdown())
|
||||
def shutdown():
|
||||
# indicates that everything should stop
|
||||
daemonStatus.stop()
|
||||
# if a new sigterm signal is caught it should force the shutdown of children processes
|
||||
signal.signal(signal.SIGTERM, lambda signal_no, frame: force_shutdown())
|
||||
|
||||
signal.signal(signal.SIGTERM, lambda signal_no, frame: shutdown())
|
||||
|
||||
|
|
Loading…
Reference in a new issue