Commit 3bddcc22 authored by echel0n's avatar echel0n

Refactored application startup to install requirements via pip if...

Refactored application startup to install requirements via pip if ModuleNotFound exception is thrown.
parent 5dca187f
......@@ -20,12 +20,12 @@
# ##############################################################################
import argparse
import atexit
import gettext
import os
import site
import subprocess
import sys
import threading
import time
......@@ -219,7 +219,12 @@ def main():
gettext.install('messages', LOCALE_DIR, codeset='UTF-8', names=["ngettext"])
try:
from sickrage.core import Core
try:
from sickrage.core import Core
except ModuleNotFoundError:
print('Attempting to install SiCKRAGE missing requirements using pip')
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
from sickrage.core import Core
# main app instance
app = Core()
......@@ -360,5 +365,6 @@ def main():
except Exception:
traceback.print_exc()
if __name__ == '__main__':
main()
......@@ -713,8 +713,7 @@ class PipUpdateManager(UpdateManager):
try:
pypi_version = self.get_newest_version
if self.version != pypi_version:
sickrage.app.log.debug(
"Version upgrade: " + self._find_installed_version() + " -> " + pypi_version)
sickrage.app.log.debug("Version upgrade: " + self._find_installed_version() + " -> " + pypi_version)
return True
except Exception as e:
sickrage.app.log.warning("Unable to contact PyPi, can't check for update: " + repr(e))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment