Skip to content

Commit 22c7403

Browse files
committed
Show version number in app and logs
1 parent 3d4d8f2 commit 22c7403

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ If you wish to backup the TA partition first, you can find tutorials related to
3636

3737
## Usage
3838

39-
Linux is currently the best supported platform (tested with Ubuntu 20.04 LTS). Windows and MacOS are also supported but you might experience more issues. So far there is no support for ARM-based systems.
39+
Linux is currently the best supported platform (tested with Ubuntu 20.04/22.04 LTS). Windows and MacOS are also supported but you might experience more issues. So far there is no support for ARM-based systems.
4040

4141
1. Download the AppImage, .exe or appropriate executable file for your OS. You might need to change permissions to run the executable.
4242
- On Windows also [install the Universal USB Drivers](https://adb.clockworkmod.com/) and other potentially drivers needed for your device.

openandroidinstaller/openandroidinstaller.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
# where to write the logs
5353
logger.add("openandroidinstaller.log")
5454

55+
# VERSION number
56+
VERSION = "0.3.4-alpha"
5557

5658
# detect platform
5759
PLATFORM = sys.platform
@@ -141,19 +143,18 @@ def configure(page: Page):
141143
def log_version_infos(bin_path):
142144
"""Log the version infos of adb, fastboot and heimdall."""
143145
# adb
144-
adbversion = [line for line in run_command("adb", ["version"], bin_path)]
145-
adbversion = "\n".join(adbversion[:1])
146-
logger.info(f"{adbversion}")
146+
adbversion = [line for line in run_command("adb", ["version"], bin_path, enable_logging=False)]
147+
logger.info(f"{adbversion[1].strip()}")
147148
# fastboot
148-
fbversion = [line for line in run_command("fastboot", ["--version"], bin_path)]
149-
logger.info(f"{fbversion[0]}")
149+
fbversion = [line for line in run_command("fastboot", ["--version"], bin_path, enable_logging=False)]
150+
logger.info(f"{fbversion[1].strip()}")
150151
# heimdall
151-
hdversion = [line for line in run_command("heimdall", ["info"], bin_path)]
152-
logger.info(f"Heimdall version: {hdversion[0]}")
152+
hdversion = [line for line in run_command("heimdall", ["info"], bin_path, enable_logging=False)]
153+
logger.info(f"Heimdall version: {hdversion[1].strip()}")
153154

154155

155156
def main(page: Page, test: bool = False, test_config: str = "sargo"):
156-
logger.info(f"Running OpenAndroidInstaller on {PLATFORM}")
157+
logger.info(f"Running OpenAndroidInstaller version '{VERSION}' on '{PLATFORM}'.")
157158
log_version_infos(bin_path=BIN_PATH)
158159
logger.info(100 * "-")
159160

@@ -168,7 +169,7 @@ def main(page: Page, test: bool = False, test_config: str = "sargo"):
168169
leading_width=56,
169170
toolbar_height=72,
170171
elevation=0,
171-
title=Text("OpenAndroidInstaller alpha version", style="displaySmall"),
172+
title=Text(f"OpenAndroidInstaller version {VERSION}", style="displaySmall"),
172173
center_title=False,
173174
bgcolor="#00d886",
174175
actions=[

openandroidinstaller/tooling.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
PLATFORM = sys.platform
3333

3434

35-
def run_command(tool: str, command: List[str], bin_path: Path) -> CompletedProcess:
35+
def run_command(tool: str, command: List[str], bin_path: Path, enable_logging: bool = True) -> CompletedProcess:
3636
"""Run a command with a tool (adb, fastboot, heimdall)."""
3737
yield f"${' '.join([tool] + command )}"
3838
if tool not in ["adb", "fastboot", "heimdall"]:
@@ -45,7 +45,8 @@ def run_command(tool: str, command: List[str], bin_path: Path) -> CompletedProce
4545
else:
4646
full_command = [str(bin_path.joinpath(Path(f"{tool}")))] + command
4747
si = None
48-
logger.info(f"Run command: {full_command}")
48+
if enable_logging:
49+
logger.info(f"Run command: {full_command}")
4950
# run the command
5051
with Popen(
5152
full_command,
@@ -56,7 +57,8 @@ def run_command(tool: str, command: List[str], bin_path: Path) -> CompletedProce
5657
startupinfo=si,
5758
) as p:
5859
for line in p.stdout:
59-
logger.info(line.strip())
60+
if enable_logging:
61+
logger.info(line.strip())
6062
yield line
6163

6264
yield p.returncode == 0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "openandroidinstaller"
3-
version = "0.3.2-alpha"
3+
version = "0.3.4-alpha"
44
description = "Install lineage OS in a nice and easy way."
55
authors = ["Tobias Sterbak <[email protected]>"]
66
license = "GPLv3"

0 commit comments

Comments
 (0)