This commit is contained in:
Louis Vézina 2020-01-30 10:14:51 -05:00
parent 83c95cc77d
commit 2a77abc918
2 changed files with 11 additions and 54 deletions

View File

@ -4,33 +4,25 @@ from __future__ import absolute_import
from __future__ import print_function from __future__ import print_function
import bazarr.libs import bazarr.libs
from six import PY3
import subprocess as sp import subprocess as sp
import time import time
import os import os
import sys import sys
import platform
import re
from bazarr.get_args import args from bazarr.get_args import args
def check_python_version(): def check_python_version():
python_version = platform.python_version_tuple() python_version = (sys.version_info.major, sys.version_info.minor, sys.version_info.micro)
minimum_python_version_tuple = (2, 7, 13) python_version_str = '.'.join(map(str, python_version))
minimum_python3_version_tuple = (3, 6, 0) minimum_python3_version = (3, 6, 0)
minimum_python_version = ".".join(str(i) for i in minimum_python_version_tuple) minimum_python3_version_str = '.'.join(map(str, minimum_python3_version))
minimum_python3_version = ".".join(str(i) for i in minimum_python3_version_tuple)
if int(python_version[0]) == minimum_python3_version_tuple[0]: if python_version >= minimum_python3_version:
if int(python_version[1]) >= minimum_python3_version_tuple[1]: pass
pass else:
else: print("Python " + minimum_python3_version_str + " or greater required. Current version is " +
print("Python " + minimum_python3_version + " or greater required. Current version is " + platform.python_version() + ". Please upgrade Python.") python_version_str + ". Please upgrade Python.")
os._exit(0)
elif int(python_version[1]) < minimum_python_version_tuple[1] or int(re.search(r'\d+', python_version[2]).group()) < 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) os._exit(0)
@ -49,10 +41,7 @@ def start_bazarr():
line = ep.stdout.readline() line = ep.stdout.readline()
if line == '' or not line: if line == '' or not line:
break break
if PY3: sys.stdout.buffer.write(line)
sys.stdout.buffer.write(line)
else:
sys.stdout.write(line)
sys.stdout.flush() sys.stdout.flush()
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass

View File

@ -230,39 +230,7 @@
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% end %}
% from six import PY2
% import datetime
% if PY2:
<div class='ui left aligned grid'>
<div class='fluid column'>
<div class="ui yellow icon message">
<i class="python icon"></i>
<div class="content">
<div class="header">Python deprecation warning</div>
Bazarr is now compatible with Python 3.6 and newer. You should upgrade Python as we'll drop support
for Python 2.7.x by the end of 2019.
<div class="ui bulleted list">
% if os.name == 'posix':
<div class="item">If you are running under Docker, don't worry, we'll take care of this for you.
Just pull the new image.
</div>
% end
% if os.name == 'nt':
<div class="item">If you have installed using the Windows Installer, we'll provide a new
installer soon.
</div>
% end
<div class="item">If you are running from source, it's up to you to install Python 3 and use it
to run Bazarr.
</div>
</div>
</div>
</div>
</div>
</div>
% end
</div> </div>
</body> </body>
</html> </html>