diff --git a/client/Pipfile b/client/Pipfile index 2b0186c..8d46794 100644 --- a/client/Pipfile +++ b/client/Pipfile @@ -13,7 +13,7 @@ click = "*" requests = "*" rich = "*" pyserial = "*" -kivy = "*" +kivy = { version = "*", platform_machine = "!= 'aarch64'" } bitstring = "*" [dev-packages] diff --git a/client/Pipfile.lock b/client/Pipfile.lock index 9891b3c..82928c5 100644 --- a/client/Pipfile.lock +++ b/client/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "2a7c4e968400a1f1687f44d5ab0921941394f9025b139c909aebabe7b7b89082" + "sha256": "250c2a27447281efb0f9ce4593f24034b0ca8a97cbfdb227799822062a629b18" }, "pipfile-spec": 6, "requires": { @@ -108,7 +108,7 @@ "sha256:6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7", "sha256:e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951" ], - "markers": "python_version < '4' and python_full_version >= '3.6.1'", + "markers": "python_full_version >= '3.6.1' and python_full_version < '4.0.0'", "version": "==5.10.1" }, "kivy": { @@ -132,6 +132,7 @@ "sha256:ef3727a47a565e6ea486365ee310bfb0445fcf7f0ab40c1461cbf304973637eb" ], "index": "pypi", + "markers": "platform_machine != 'aarch64'", "version": "==2.0.0" }, "kivy-garden": { @@ -309,7 +310,7 @@ "sha256:000ca7f471a233c2251c6c7023ee85305721bfdf18621ebff4fd17a8653427ed", "sha256:0e7c33d9a63e7ddfcb86780aac87befc2fbddf46c58dbb487e0855f7ceec283c" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_full_version < '4.0.0'", "version": "==1.26.8" }, "websockets": { diff --git a/client/hook-cli.py b/client/hook-cli.py index 3d25d62..849a175 100644 --- a/client/hook-cli.py +++ b/client/hook-cli.py @@ -1,5 +1,9 @@ """A hint for pyinstaller to pack additional hidden imports/libraries""" -hiddenimports = [ +import monitor_serial_button_led_bytes_app + +is_kivy_available = monitor_serial_button_led_bytes_app.is_kivy_available() + +kivy_imports = [ "kivy", "kivy.app.*", "kivy.uix.button.*", @@ -8,3 +12,5 @@ "kivy.core.window.*", "kivy.properties.*", ] + +hiddenimports = kivy_imports if is_kivy_available else [] diff --git a/client/monitor_serial_button_led_bytes_app.py b/client/monitor_serial_button_led_bytes_app.py index ca648d0..3d39fec 100644 --- a/client/monitor_serial_button_led_bytes_app.py +++ b/client/monitor_serial_button_led_bytes_app.py @@ -1,5 +1,6 @@ """Module for functionality related to serial socket monitoring as button/led byte stream, specifically graphics/UI""" +from sys import platform import asyncio from typing import Callable, Optional import log @@ -51,7 +52,18 @@ def update(self, state: AppState): hacked_global_app_state_storage = AppStateStorage() +def is_kivy_available() -> bool: + try: + import kivy + return True + except ImportError: + return False + + def define_app(): + if not is_kivy_available(): + raise Exception("Kivy graphics library not available") + import kivy from kivy.app import App from kivy.uix.button import Button