Skip to content

Commit

Permalink
Remove Kivy from aarch64 platform build
Browse files Browse the repository at this point in the history
  • Loading branch information
Krisjanis Veinbahs committed Jan 8, 2022
1 parent 14027c3 commit 47f783a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ click = "*"
requests = "*"
rich = "*"
pyserial = "*"
kivy = "*"
kivy = { version = "*", platform_machine = "!= 'aarch64'" }
bitstring = "*"

[dev-packages]
Expand Down
7 changes: 4 additions & 3 deletions client/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion client/hook-cli.py
Original file line number Diff line number Diff line change
@@ -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.*",
Expand All @@ -8,3 +12,5 @@
"kivy.core.window.*",
"kivy.properties.*",
]

hiddenimports = kivy_imports if is_kivy_available else []
12 changes: 12 additions & 0 deletions client/monitor_serial_button_led_bytes_app.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 47f783a

Please sign in to comment.