diff options
author | Louis Vézina <[email protected]> | 2019-09-13 15:12:26 -0400 |
---|---|---|
committer | Louis Vézina <[email protected]> | 2019-09-13 15:12:26 -0400 |
commit | 645952c61aba3cccb5ca919be966a7ba02d853fa (patch) | |
tree | 005362d11c260b4293b427ed8ba9d94e8b478ec3 /bazarr.py | |
parent | 4e7e3a39d26cb3771876b43c82a747f6c6526dda (diff) | |
download | bazarr-645952c61aba3cccb5ca919be966a7ba02d853fa.tar.gz bazarr-645952c61aba3cccb5ca919be966a7ba02d853fa.zip |
WIP
Diffstat (limited to 'bazarr.py')
-rw-r--r-- | bazarr.py | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -1,5 +1,7 @@ # coding=utf-8 +from __future__ import absolute_import +from __future__ import print_function import subprocess as sp import time import os @@ -12,14 +14,16 @@ from bazarr.get_args import args def check_python_version(): python_version = platform.python_version_tuple() minimum_python_version_tuple = (2, 7, 13) + minimum_python3_version_tuple = (3, 6, 0) minimum_python_version = ".".join(str(i) for i in minimum_python_version_tuple) + minimum_python3_version = ".".join(str(i) for i in minimum_python3_version_tuple) - if int(python_version[0]) > minimum_python_version_tuple[0]: - print "Python 3 isn't supported. Please use Python " + minimum_python_version + " or greater." + if int(python_version[0]) == minimum_python3_version_tuple[0] and int(python_version[1]) < minimum_python3_version_tuple[1]: + print("Python " + minimum_python3_version + " or greater required. Current version is " + platform.python_version() + ". Please upgrade Python.") os._exit(0) - elif int(python_version[1]) < minimum_python_version_tuple[1] or int(python_version[2].rstrip('+')) < minimum_python_version_tuple[2]: - print "Python " + minimum_python_version + " or greater required. Current version is " + platform.python_version() + ". Please upgrade Python." + elif int(python_version[0]) == minimum_python_version_tuple[0] and (int(python_version[1]) < minimum_python_version_tuple[1] or int(python_version[2].rstrip('+')) < minimum_python_version_tuple[2]): + print("Python " + minimum_python_version + " or greater required. Current version is " + platform.python_version() + ". Please upgrade Python.") os._exit(0) @@ -32,10 +36,10 @@ def start_bazarr(): script = [sys.executable, "-u", os.path.normcase(os.path.join(dir_name, 'bazarr', 'main.py'))] + sys.argv[1:] ep = sp.Popen(script, stdout=sp.PIPE, stderr=sp.STDOUT, stdin=sp.PIPE) - print "Bazarr starting..." + print("Bazarr starting...") try: for line in iter(ep.stdout.readline, ''): - sys.stdout.write(line) + sys.stdout.buffer.write(line) except KeyboardInterrupt: pass @@ -60,16 +64,16 @@ if __name__ == '__main__': try: os.remove(stopfile) except: - print 'Unable to delete stop file.' + print('Unable to delete stop file.') else: - print 'Bazarr exited.' + print('Bazarr exited.') os._exit(0) if os.path.exists(restartfile): try: os.remove(restartfile) except: - print 'Unable to delete restart file.' + print('Unable to delete restart file.') else: start_bazarr() |