Skip to content

Commit 4fabe44

Browse files
committed
- Roll up MacOS related changes. #187 and #190
- Logging improvements - When Magisk delta is installed, automatically set the package to: `io.github.huskydg.magisk`
1 parent 014cc81 commit 4fabe44

File tree

9 files changed

+63
-17
lines changed

9 files changed

+63
-17
lines changed

Main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,9 +2184,11 @@ def _refresh_ui(self):
21842184
def _print_device_details(self, device):
21852185
m_version = 0
21862186
m_app_version = 0
2187-
message = ''
2187+
21882188
print('')
2189+
message = '=======================================\n'
21892190
message += f"Selected Device on {datetime.now():%Y-%m-%d %H:%M:%S}:\n"
2191+
message += '=======================================\n'
21902192
message += f" Device ID: {device.id}\n"
21912193
message += f" Device Model: {device.hardware}\n"
21922194
message += f" Device Active Slot: {device.active_slot}\n"
@@ -2656,7 +2658,7 @@ def update_widget_states(self):
26562658
self.pif_info_menu_item: ['device_attached'],
26572659
self.props_as_json_menu_item: ['device_attached'],
26582660
self.xml_view_menu_item: ['device_attached'],
2659-
self.cancel_ota_menu_item: ['device_attached'],
2661+
self.cancel_ota_menu_item: ['device_attached', 'device_mode_adb'],
26602662
self.push_menu: ['device_attached'],
26612663
self.push_file_to_tmp_menu: ['device_attached'],
26622664
self.push_file_to_download_menu: ['device_attached'],

build-on-mac.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ exe = EXE(pyz,
2828
icon='images/icon-dark-256.icns')
2929
app = BUNDLE(exe,
3030
name='PixelFlasher.app',
31-
version='6.9.2.4',
31+
version='6.9.2.5',
3232
icon='./images/icon-dark-256.icns',
3333
bundle_identifier='com.badabing.pixelflasher')

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
rm -rf build dist
3-
VERSION=6.9.2.4
3+
VERSION=6.9.2.5
44
NAME="PixelFlasher"
55
DIST_NAME="PixelFlasher"
66

constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
APPNAME = 'PixelFlasher'
44
CONFIG_FILE_NAME = 'PixelFlasher.json'
5-
VERSION = '6.9.2.4'
5+
VERSION = '6.9.2.5'
66
SDKVERSION = '33.0.3'
77
MAIN_WIDTH = 1400
88
MAIN_HEIGHT = 1040

modules.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1787,6 +1787,10 @@ def patch_magisk_script(patch_method):
17871787
magisk_path = f"{self.config.phone_path}/Magisk-Uploaded.apk"
17881788
else:
17891789
magisk_path = device.magisk_path
1790+
if not magisk_path:
1791+
print("ERROR: Magisk path is empty!\nAborting ...")
1792+
puml("#red:Magisk path is empty;\n")
1793+
return -1
17901794
data += f"MAGISK_PATH={magisk_path}\n"
17911795

17921796
if patch_method in ["app", "other"]:
@@ -4095,7 +4099,7 @@ def flash_phone(self):
40954099
os.chdir(package_dir_full)
40964100
theCmd = f"\"{theCmd}\""
40974101
debug(theCmd)
4098-
res = run_shell2(theCmd, env=get_env_variables())
4102+
res = run_shell2(theCmd)
40994103
if res.returncode != 0:
41004104
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Encountered an error while running flash script.")
41014105
print(f"theCmd: {theCmd}")

phone.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ def get_verity_verification(self, item):
751751
# ----------------------------------------------------------------------------
752752
def reset_ota_update(self):
753753
if self.mode != 'adb':
754+
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: reset_ota_update function is only available in adb mode.\nAborting ...")
754755
return -1
755756
if not self.rooted:
756757
return -1
@@ -2476,7 +2477,7 @@ def get_magisk_apk_details(self, channel):
24762477
note_link = data['magisk']['note']
24772478
setattr(ma, 'note_link', note_link)
24782479
setattr(ma, 'package', MAGISK_PKG_NAME)
2479-
if channel in ['delta canary', 'delta debug']:
2480+
if channel in ['Magisk Delta Canary', 'Magisk Delta Debug']:
24802481
setattr(ma, 'package', MAGISK_DELTA_PKG_NAME)
24812482
# Get the note contents
24822483
headers = {}
@@ -3363,12 +3364,12 @@ def scrcpy(self):
33633364
if sys.platform.startswith("win"):
33643365
# subprocess.Popen(theCmd, cwd=scrcpy_folder, start_new_session=True, creationflags=subprocess.CREATE_NEW_CONSOLE)
33653366
debug(theCmd)
3366-
res = run_shell2(theCmd, directory=scrcpy_folder, detached=True, creationflags=subprocess.CREATE_NEW_CONSOLE)
3367+
res = run_shell3(theCmd, directory=scrcpy_folder, detached=True, creationflags=subprocess.CREATE_NEW_CONSOLE)
33673368
elif sys.platform.startswith("linux") and config.linux_shell:
33683369
# subprocess.Popen([get_linux_shell(), "--", "/bin/bash", "-c", theCmd], start_new_session=True)
33693370
theCmd = f"{get_linux_shell()} -- /bin/bash -c {theCmd}"
33703371
debug(theCmd)
3371-
res = run_shell2(theCmd, detached=True)
3372+
res = run_shell3(theCmd, detached=True)
33723373
elif sys.platform.startswith("darwin"):
33733374
script_file = tempfile.NamedTemporaryFile(delete=False, suffix='.sh')
33743375
script_file_content = f'#!/bin/bash\n{theCmd}\nrm "{script_file.name}"'
@@ -3379,7 +3380,7 @@ def scrcpy(self):
33793380
theCmd = f"osascript -e 'tell application \"Terminal\" to do script \"{script_file.name}\"'"
33803381
debug(theCmd)
33813382
# subprocess.Popen(['osascript', '-e', f'tell application "Terminal" to do script "{script_file.name}"'], start_new_session=True, env=get_env_variables())
3382-
res = run_shell2(theCmd, detached=True, env=get_env_variables())
3383+
res = run_shell3(theCmd, detached=True, env=get_env_variables())
33833384
return 0
33843385
else:
33853386
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: The Device: {self.id} is not in adb mode.")

runtime.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3504,7 +3504,46 @@ def run_shell(cmd, timeout=None, encoding='ISO-8859-1'):
35043504
# Function run_shell2
35053505
# ============================================================================
35063506
# This one pipes the stdout and stderr to Console text widget in realtime,
3507-
def run_shell2(cmd, timeout=None, detached=False, directory=None, encoding='ISO-8859-1', creationflags=0, env=None):
3507+
def run_shell2(cmd, timeout=None, detached=False, directory=None, encoding='ISO-8859-1'):
3508+
try:
3509+
flush_output()
3510+
if directory is None:
3511+
proc = subprocess.Popen(f"{cmd}", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding=encoding, errors="replace", start_new_session=detached, env=get_env_variables())
3512+
else:
3513+
proc = subprocess.Popen(f"{cmd}", cwd=directory, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding=encoding, errors="replace", start_new_session=detached, env=get_env_variables())
3514+
3515+
print
3516+
while True:
3517+
line = proc.stdout.readline()
3518+
wx.YieldIfNeeded()
3519+
if line.strip() != "":
3520+
print(line.strip())
3521+
if not line:
3522+
break
3523+
if timeout is not None and time.time() > timeout:
3524+
proc.terminate()
3525+
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Command {cmd} timed out after {timeout} seconds")
3526+
puml("#red:Command timed out;\n", True)
3527+
puml(f"note right\nCommand {cmd} timed out after {timeout} seconds\nend note\n")
3528+
return subprocess.CompletedProcess(args=cmd, returncode=-1, stdout='', stderr='')
3529+
proc.wait()
3530+
# Wait for the process to complete and capture the output
3531+
stdout, stderr = proc.communicate()
3532+
return subprocess.CompletedProcess(args=cmd, returncode=proc.returncode, stdout=stdout, stderr=stderr)
3533+
except Exception as e:
3534+
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Encountered an error while executing run_shell2 {cmd}")
3535+
traceback.print_exc()
3536+
puml("#red:Encountered an error;\n", True)
3537+
puml(f"note right\n{e}\nend note\n")
3538+
raise e
3539+
# return subprocess.CompletedProcess(args=cmd, returncode=-2, stdout='', stderr='')
3540+
3541+
3542+
# ============================================================================
3543+
# Function run_shell3
3544+
# ============================================================================
3545+
# This one pipes the stdout and stderr to Console text widget in realtime,
3546+
def run_shell3(cmd, timeout=None, detached=False, directory=None, encoding='ISO-8859-1', creationflags=0, env=None):
35083547
try:
35093548
flush_output()
35103549
proc_args = {
@@ -3551,7 +3590,7 @@ def read_output():
35513590
return proc
35523591

35533592
except Exception as e:
3554-
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Encountered an error while executing run_shell2 {cmd}")
3593+
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Encountered an error while executing run_shell3 {cmd}")
35553594
traceback.print_exc()
35563595
puml("#red:Encountered an error;\n", True)
35573596
puml(f"note right\n{e}\nend note\n")

windows-metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# https://github.com/DudeNr33/pyinstaller-versionfile
22
# create-version-file windows-metadata.yaml --outfile windows-version-info.txt
3-
Version: 6.9.2.4
3+
Version: 6.9.2.5
44
FileDescription: PixelFlasher
55
InternalName: PixelFlasher
66
OriginalFilename: PixelFlasher.exe

windows-version-info.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ VSVersionInfo(
77
ffi=FixedFileInfo(
88
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
99
# Set not needed items to zero 0. Must always contain 4 elements.
10-
filevers=(6,9,2,4),
11-
prodvers=(6,9,2,4),
10+
filevers=(6,9,2,5),
11+
prodvers=(6,9,2,5),
1212
# Contains a bitmask that specifies the valid bits 'flags'r
1313
mask=0x3f,
1414
# Contains a bitmask that specifies the Boolean attributes of the file.
@@ -32,12 +32,12 @@ VSVersionInfo(
3232
u'040904B0',
3333
[StringStruct(u'CompanyName', u''),
3434
StringStruct(u'FileDescription', u'PixelFlasher'),
35-
StringStruct(u'FileVersion', u'6.9.2.4'),
35+
StringStruct(u'FileVersion', u'6.9.2.5'),
3636
StringStruct(u'InternalName', u'PixelFlasher'),
3737
StringStruct(u'LegalCopyright', u''),
3838
StringStruct(u'OriginalFilename', u'PixelFlasher.exe'),
3939
StringStruct(u'ProductName', u'PixelFlasher'),
40-
StringStruct(u'ProductVersion', u'6.9.2.4')])
40+
StringStruct(u'ProductVersion', u'6.9.2.5')])
4141
]),
4242
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
4343
]

0 commit comments

Comments
 (0)