Add raspberryPI support

This commit is contained in:
Alessandro
2020-04-11 00:50:37 +02:00
parent ab32fbbf98
commit 995696f11a
5 changed files with 23 additions and 3 deletions

View File

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

View File

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

View File

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

View File

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

View File

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