Update to stop using "import pip" which is an unsupported usage.

This commit is contained in:
morpheus65535 2018-03-28 12:07:35 -04:00
parent a6c067e79f
commit 0a6b82eedd
2 changed files with 25 additions and 19 deletions

View file

@ -8,7 +8,6 @@ enzyme
gitpython gitpython
langdetect langdetect
Pillow Pillow
pip<=9.0.1
py-pretty py-pretty
pycountry pycountry
pytz pytz

View file

@ -1,21 +1,28 @@
import pip import subprocess
from subprocess import check_output
import logging
import os
import sys
try: try:
pip.main(['install', '--user', 'gitpython']) logging.info('Installing Python modules required for Bazarr...')
except SystemExit as e:
pass
try: command = sys.executable + ' -m pip --disable-pip-version-check -q -q install -r ' + os.path.join(os.path.dirname(__file__), 'requirements.txt')
pip.main(['install', '--user', 'langdetect'])
except SystemExit as e:
pass
try: if os.name == 'nt':
pip.main(['install', '--user', 'apprise']) codepage = check_output("chcp", shell=True, stderr=subprocess.STDOUT)
except SystemExit as e: encoding = codepage.split(':')[-1].strip()
pass
try: process = check_output(command, shell=True, stderr=subprocess.STDOUT)
pip.main(['install', '--user', 'tzlocal'])
except SystemExit as e: if os.name == 'nt':
process = process.decode(encoding)
except:
logging.error('Unable to install requirements using command line PIP. Is PIP installed and included in system path?')
pass pass
else:
if process == "":
logging.info('Required Python modules installed if missing.')
else:
for line in process.splitlines():
logging.error(line)