Commit 09466b1a authored by echel0n's avatar echel0n
Browse files

Misc code improvements for Plex notifier

Refactored database backups to use pickle default protocol to stay compatible with Python 3.5.x
Refactored aniDBfileInfo.py to use pickle default protocol to stay compatible with Python 3.5.x
Pinned pyasn1 to v0.4.8 in requirements.txt
Refactored requirements.txt to be installed while ignoring previously installed versions to avoid conflicts from base installed packages when running inside a virtual python env
parent a0cdf3cb
......@@ -46,9 +46,9 @@ sqlalchemy-migrate==0.13.0
mutagen==1.45.1
deluge-client==1.9.0
dirsync==2.2.5
pyasn1==0.4.8
PyMySQL
certifi
pyasn1
asn1crypto
lxml
ipaddress
......
......@@ -45,7 +45,7 @@ VERSION_FILE = os.path.join(PROG_DIR, 'version.txt')
CHANGELOG_FILE = os.path.join(MAIN_DIR, 'CHANGELOG.md')
REQS_FILE = os.path.join(MAIN_DIR, 'requirements.txt')
CHECKSUM_FILE = os.path.join(PROG_DIR, 'checksums.md5')
AUTO_PROCESS_TV_CFG_FILE = os.path.join(*[PROG_DIR, 'autoProcessTV', 'autoProcessTV.cfg'])
class Daemon(object):
"""
......@@ -186,10 +186,10 @@ def check_requirements():
req_name, req_version = line.strip().split('==')
if not pkg_resources.get_distribution(req_name).version == req_version:
print('Updating requirement {} to {}'.format(req_name, req_version))
subprocess.check_call([sys.executable, "-m", "pip", "install", "--no-cache-dir", line.strip()])
subprocess.check_call([sys.executable, "-m", "pip", "install", "--ignore-installed", "--no-cache-dir", line.strip()])
except pkg_resources.DistributionNotFound:
print('Installing requirement {}'.format(line.strip()))
subprocess.check_call([sys.executable, "-m", "pip", "install", "--no-cache-dir", line.strip()])
subprocess.check_call([sys.executable, "-m", "pip", "install", "--ignore-installed", "--no-cache-dir", line.strip()])
except ValueError:
continue
......@@ -207,6 +207,7 @@ def check_requirements():
def file_cleanup(remove=False):
valid_files = []
exempt_files = [pathlib.Path(CHECKSUM_FILE), pathlib.Path(AUTO_PROCESS_TV_CFG_FILE)]
if not os.path.exists(CHECKSUM_FILE):
return
......@@ -221,7 +222,7 @@ def file_cleanup(remove=False):
for file in files:
full_filename = pathlib.Path(root).joinpath(file)
if full_filename == pathlib.Path(CHECKSUM_FILE) or full_filename.suffix == '.pyc':
if full_filename in exempt_files or full_filename.suffix == '.pyc':
continue
if full_filename not in valid_files and PROG_DIR in str(full_filename):
......
......@@ -352,10 +352,10 @@ class UpdateManager(object):
os.unlink(requirements_file.name)
return False
output, __, exit_status = self._pip_cmd('install --no-cache-dir -r {}'.format(requirements_file.name))
output, __, exit_status = self._pip_cmd('install --ignore-installed --no-cache-dir -r {}'.format(requirements_file.name))
if exit_status != 0:
__, __, exit_status = self._pip_cmd('install --no-cache-dir --user -r {}'.format(requirements_file.name))
__, __, exit_status = self._pip_cmd('install --ignore-installed --no-cache-dir --user -r {}'.format(requirements_file.name))
if exit_status == 0:
requirements_file.close()
......
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