Merge commit '5af0faaa65432db23d391ee65a6fe9f85021f032'

This commit is contained in:
AresValley
2020-04-18 21:04:16 +02:00
5 changed files with 23 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ class SupportedOs:
WINDOWS = "windows" WINDOWS = "windows"
LINUX = "linux" LINUX = "linux"
MAC = "mac" MAC = "mac"
RASPBIAN = "raspberry"
class Ftype: class Ftype:

View File

@@ -49,6 +49,7 @@ class _TarExtractor:
EXTRACTORS = { EXTRACTORS = {
SupportedOs.WINDOWS: _ZipExtractor, SupportedOs.WINDOWS: _ZipExtractor,
SupportedOs.LINUX: _TarExtractor, SupportedOs.LINUX: _TarExtractor,
SupportedOs.RASPBIAN: _TarExtractor,
# No extractor for MacOs, just download the file through the browser. # No extractor for MacOs, just download the file through the browser.
} }

View File

@@ -1,4 +1,5 @@
import sys import sys
import platform
from constants import SupportedOs from constants import SupportedOs
@@ -20,6 +21,7 @@ def _is_linux_os():
IS_MAC = _is_mac_os() IS_MAC = _is_mac_os()
IS_LINUX = _is_linux_os() IS_LINUX = _is_linux_os()
IS_WINDOWS = _is_win_os() IS_WINDOWS = _is_win_os()
IS_RASPBIAN = IS_LINUX and 'arm' in platform.machine().lower()
def get_os(): def get_os():
@@ -27,8 +29,10 @@ def get_os():
if IS_WINDOWS: if IS_WINDOWS:
return SupportedOs.WINDOWS return SupportedOs.WINDOWS
elif IS_LINUX: elif IS_LINUX:
if IS_RASPBIAN:
return SupportedOs.RASPBIAN
return SupportedOs.LINUX return SupportedOs.LINUX
elif IS_MAC: elif IS_MAC:
return SupportedOs.MAC return SupportedOs.MAC
else: else:
raise Exception("ERROR: OS not recognized.") return None

View File

@@ -112,7 +112,7 @@ class UpdatesController(QObject):
If so, ask to download the new version. If so, ask to download the new version.
If the software is not a compiled version, the function is a NOP.""" If the software is not a compiled version, the function is a NOP."""
if not IS_BINARY or IS_MAC: if not IS_BINARY or IS_MAC:
return return None
latest_updater_version = self.version_controller.updater.version latest_updater_version = self.version_controller.updater.version
try: try:
with sp.Popen( with sp.Popen(
@@ -127,7 +127,7 @@ class UpdatesController(QObject):
logging.error("Unable to query the updater") logging.error("Unable to query the updater")
updater_version = latest_updater_version updater_version = latest_updater_version
if latest_updater_version is None: if latest_updater_version is None:
return return None
if updater_version != latest_updater_version: if updater_version != latest_updater_version:
answer = pop_up( answer = pop_up(
self._owner, self._owner,

View File

@@ -61,6 +61,20 @@ def _download_versions_file():
"size": ... "size": ...
} }
} }
"raspberry": {
"software": {
"version": "...",
"url": "...",
"hash_code": "...",
"size": ...
},
"updater": {
"version": "...",
"url": "...",
"hash_code": "...",
"size": ...
}
}
} }
""" """
return json.load( return json.load(