pull/936/head
Louis Vézina 5 years ago
parent 1f25fdde2f
commit b2d8d49495

@ -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 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 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())
signal.signal(signal.SIGTERM, lambda signal_no, frame: shutdown())

Loading…
Cancel
Save