mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-21 03:04:31 +10:00
Display Commit Info in Dev Debug menu
This commit is contained in:
40
resources/commit_info.py
Normal file
40
resources/commit_info.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# Parse Commit Info from binary's info.plist
|
||||
# App Structure:
|
||||
# OpenCore-Patcher.app:
|
||||
# Contents:
|
||||
# MacOS:
|
||||
# OpenCore-Patcher
|
||||
# Info.plist
|
||||
|
||||
from pathlib import Path
|
||||
import plistlib
|
||||
|
||||
class commit_info:
|
||||
|
||||
def __init__(self, binary_path):
|
||||
self.binary_path = str(binary_path)
|
||||
self.plist_path = self.convert_binary_path_to_plist_path()
|
||||
|
||||
|
||||
def convert_binary_path_to_plist_path(self):
|
||||
if Path(self.binary_path).exists():
|
||||
plist_path = self.binary_path.replace("MacOS/OpenCore-Patcher", "Info.plist")
|
||||
if Path(plist_path).exists() and plist_path.endswith(".plist"):
|
||||
return plist_path
|
||||
return None
|
||||
|
||||
def generate_commit_info(self):
|
||||
if self.plist_path:
|
||||
# print(self.plist_path)
|
||||
plist_info = plistlib.load(Path(self.plist_path).open("rb"))
|
||||
if "Github" in plist_info:
|
||||
return (
|
||||
plist_info["Github"]["Branch"],
|
||||
plist_info["Github"]["Commit Date"],
|
||||
plist_info["Github"]["Commit URL"],
|
||||
)
|
||||
return (
|
||||
"Running from source",
|
||||
"Not applicable",
|
||||
"",
|
||||
)
|
||||
@@ -193,6 +193,7 @@ class Constants:
|
||||
self.host_is_non_metal = False # Determine if host is non-metal (ie. enable UI hacks)
|
||||
self.needs_to_open_preferences = False # Determine if preferences need to be opened
|
||||
self.host_is_hackintosh = False # Determine if host is Hackintosh
|
||||
self.commit_info = (None, None, None)
|
||||
|
||||
self.legacy_accel_support = [
|
||||
os_data.os_data.big_sur,
|
||||
|
||||
@@ -8,7 +8,7 @@ from pathlib import Path
|
||||
import time
|
||||
import threading
|
||||
|
||||
from resources import build, cli_menu, constants, utilities, device_probe, os_probe, defaults, arguments, install, tui_helpers, reroute_payloads, global_settings
|
||||
from resources import build, cli_menu, constants, utilities, device_probe, os_probe, defaults, arguments, install, tui_helpers, reroute_payloads, commit_info
|
||||
from data import model_array
|
||||
|
||||
class OpenCoreLegacyPatcher:
|
||||
@@ -47,6 +47,7 @@ class OpenCoreLegacyPatcher:
|
||||
self.constants.launcher_script = launcher_script
|
||||
self.constants.unpack_thread = threading.Thread(target=reroute_payloads.reroute_payloads(self.constants).setup_tmp_disk_image)
|
||||
self.constants.unpack_thread.start()
|
||||
self.constants.commit_info = commit_info.commit_info(self.constants.launcher_binary).generate_commit_info()
|
||||
|
||||
defaults.generate_defaults.probe(self.computer.real_model, True, self.constants)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user