misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
Simone Margaritelli 2019-10-20 21:35:36 +02:00
parent 855b493040
commit df246b255a
No known key found for this signature in database
GPG Key ID: 82E42E7F3B34C97E

View File

@ -4,15 +4,16 @@ __name__ = 'auto-update'
__license__ = 'GPL3' __license__ = 'GPL3'
__description__ = 'This plugin checks when updates are available and applies them when internet is available.' __description__ = 'This plugin checks when updates are available and applies them when internet is available.'
import os
import logging import logging
import subprocess import subprocess
import requests import requests
import platform import platform
import shutil import shutil
import glob import glob
import pkg_resources
import pwnagotchi import pwnagotchi
import os
from pwnagotchi.utils import StatusFile from pwnagotchi.utils import StatusFile
OPTIONS = dict() OPTIONS = dict()
@ -45,7 +46,10 @@ def check(version, repo, native=True):
info['available'] = latest_ver = latest['tag_name'].replace('v', '') info['available'] = latest_ver = latest['tag_name'].replace('v', '')
is_arm = info['arch'].startswith('arm') is_arm = info['arch'].startswith('arm')
if latest_ver != info['current']: local = pkg_resources.parse_version(info['current'])
remote = pkg_resources.parse_requirements(latest_ver)
if remote > local:
if not native: if not native:
info['url'] = "https://github.com/%s/archive/%s.zip" % (repo, latest['tag_name']) info['url'] = "https://github.com/%s/archive/%s.zip" % (repo, latest['tag_name'])
else: else: