Skip to content

Commit 83ba6f3

Browse files
committed
Enable pyinstaller build on Ubuntu
1 parent f4059de commit 83ba6f3

13 files changed

+56
-29
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ app:
77

88
build-app:
99
poetry run pyinstaller openandroidinstaller/openandroidinstaller.py --noconsole --noconfirm --onefile --icon "/assets/favicon.ico" --add-data "openandroidinstaller/assets:assets"
10+
11+
clean-build:
12+
rm -rf build/ dist/

openandroidinstaller/__init__.py

Whitespace-only changes.

openandroidinstaller/assets/configs/Samsung Galaxy A3 2017.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ steps:
2121
content: "Return to the previous menu and tap 'Advanced Wipe', then select the 'Cache' and 'System' partitions and then 'Swipe to Wipe'."
2222
- title: "Flash LineageOS"
2323
type: confirm_button
24-
content: "On the device, go back and select “Advanced”, “ADB Sideload”, then swipe to begin sideload. Then confirm here"
24+
content: "Now connect the phone to the computer again with the USB-cable. On the device, go back and select “Advanced”, “ADB Sideload”, then swipe to begin sideload. Then confirm here"
2525
- title: "Flash LineageOS"
2626
type: call_button
2727
content: "Flash lineageOS image. Don't remove the USB-Cable!"

openandroidinstaller/installer_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""Class to load config files for the install procedure."""
2-
import yaml
32
from typing import List
43

4+
import yaml
5+
56

67
class Step:
78
def __init__(

openandroidinstaller/openandroidinstaller.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
1-
import chunk
1+
from os import path
2+
from functools import partial
3+
from subprocess import STDOUT, CalledProcessError, call, check_output
24
from time import sleep
5+
from typing import List
6+
37
import flet
48
from flet import (
5-
Divider,
69
AppBar,
7-
ElevatedButton,
8-
Page,
9-
Text,
10-
View,
11-
Row,
12-
ProgressRing,
10+
Banner,
1311
Column,
12+
Divider,
13+
ElevatedButton,
1414
FilePicker,
1515
FilePickerResultEvent,
16-
icons,
16+
Icon,
17+
Page,
1718
ProgressBar,
18-
Banner,
19-
colors,
19+
ProgressRing,
20+
Row,
21+
Text,
2022
TextButton,
21-
Icon,
2223
TextField,
24+
View,
25+
colors,
26+
icons,
2327
)
24-
from typing import List
25-
from subprocess import check_output, STDOUT, call, CalledProcessError
26-
from functools import partial
27-
2828
from installer_config import InstallerConfig
2929

30+
# CONFIG_PATH = "openandroidinstaller/assets/configs/"
31+
CONFIG_PATH = path.abspath(path.join(path.dirname(__file__), "assets/configs/"))
3032

3133
recovery_path = None
3234
image_path = None
@@ -53,7 +55,7 @@ def confirm(e):
5355
view_num = int(page.views[-1].route) + 1
5456
global num_views
5557
if num_views:
56-
pb.value = view_num / num_views
58+
pb.value = view_num / (num_views - 1)
5759
page.views.clear()
5860
page.views.append(views[view_num])
5961
page.update()
@@ -63,7 +65,6 @@ def close_banner(e):
6365
page.update()
6466

6567
def search_devices(e):
66-
config_path = "openandroidinstaller/assets/configs/"
6768
try:
6869
# read device properties
6970
output = check_output(
@@ -83,7 +84,9 @@ def search_devices(e):
8384
).decode()
8485
page.views[-1].controls.append(Text(f"Detected: {output}"))
8586
# load config from file
86-
config = InstallerConfig.from_file(config_path + output.strip() + ".yaml")
87+
config = InstallerConfig.from_file(
88+
CONFIG_PATH + "/" + output.strip() + ".yaml"
89+
)
8790
page.views[-1].controls.append(Text(f"Installer configuration found."))
8891
page.views[-1].controls.append(
8992
ElevatedButton(

poetry.lock

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ruff = "^0.0.25"
1414
pyinstaller = "^5.3"
1515
Pillow = "^9.2.0"
1616
PyYAML = "^6.0"
17+
isort = "^5.10.1"
1718

1819
[tool.poetry.dev-dependencies]
1920

scripts/check-image-for-device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Script to check if a given lineageOS image works for a connected device."""
22
from os import device_encoding
3+
from subprocess import STDOUT, check_output
34
from typing import Dict
4-
from subprocess import check_output, STDOUT
55

66

77
def get_device_info() -> Dict[str, str]:

scripts/check-install.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Check if adb works and print the version."""
2-
from subprocess import check_output, STDOUT
2+
from subprocess import STDOUT, check_output
33

44

55
def check_adb_version():

scripts/lineageos-on-galaxy-a3.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
Example usage:
66
poetry run python scripts/lineageos-on-galaxy-a3.py --recovery images/samsung-galaxy-a3/twrp-3.6.2_9-0-a3y17lte.img --image images/samsung-galaxy-a3/lineage-16.0-20190908-UNOFFICIAL-a3y17lte.zip
77
"""
8-
import click
9-
from time import sleep
108
from subprocess import call
9+
from time import sleep
10+
11+
import click
1112

1213

1314
@click.command()

0 commit comments

Comments
 (0)