mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-11 16:27:19 +10:00
Adjust Constants to python scheme
This commit is contained in:
2
.flake8
2
.flake8
@@ -1,4 +1,4 @@
|
||||
[flake8]
|
||||
extend-ignore = E501, E203
|
||||
per-file-ignores =
|
||||
Resources/Constants.py:E704
|
||||
Resources/constants.py:E704
|
||||
@@ -7,13 +7,13 @@ import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from resources import Build, cli_menu, Constants, Utilities, device_probe, os_probe, defaults, arguments
|
||||
from resources import Build, cli_menu, constants, Utilities, device_probe, os_probe, defaults, arguments
|
||||
from data import model_array
|
||||
|
||||
class OpenCoreLegacyPatcher:
|
||||
def __init__(self):
|
||||
print("- Loading...")
|
||||
self.constants = Constants.Constants()
|
||||
self.constants = constants.Constants()
|
||||
self.generate_base_data()
|
||||
if arguments.arguments().check_cli() is False:
|
||||
self.main_menu()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
import sys, os
|
||||
sys.path.append(os.path.abspath(os.getcwd()))
|
||||
from resources import Constants
|
||||
from resources import constants
|
||||
block_cipher = None
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ app = BUNDLE(exe,
|
||||
icon="payloads/OC-Patcher.icns",
|
||||
bundle_identifier=None,
|
||||
info_plist={
|
||||
"CFBundleShortVersionString": Constants.Constants().patcher_version,
|
||||
"CFBundleShortVersionString": constants.Constants().patcher_version,
|
||||
"CFBundleExecutable": "MacOS/Launcher",
|
||||
"NSHumanReadableCopyright": "Copyright 2020-2021 Dortania"
|
||||
})
|
||||
@@ -1,7 +1,7 @@
|
||||
import subprocess
|
||||
from resources import Constants
|
||||
from resources import constants
|
||||
|
||||
patcher_support_pkg_version = Constants.Constants().patcher_support_pkg_version
|
||||
patcher_support_pkg_version = constants.Constants().patcher_support_pkg_version
|
||||
binary_packages = ["10.14-Mojave", "10.15-Catalina", "11-Big-Sur", "12-Monterey"]
|
||||
|
||||
for binary_package in binary_packages:
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
# Copyright (C) 2021 Mykola Grymalyuk
|
||||
import plistlib
|
||||
from pathlib import Path
|
||||
from resources import Constants
|
||||
from resources import constants
|
||||
|
||||
app_path = Path.cwd() / Path ("OpenCore Patcher.app/Contents/Info.plist")
|
||||
info = plistlib.load(Path(app_path).open("rb"))
|
||||
info["CFBundleShortVersionString"] = Constants.Constants().patcher_version
|
||||
info["CFBundleShortVersionString"] = constants.Constants().patcher_version
|
||||
plistlib.dump(info, Path(app_path).open("wb"), sort_keys=True)
|
||||
@@ -14,7 +14,7 @@ import ast
|
||||
from pathlib import Path
|
||||
from datetime import date
|
||||
|
||||
from resources import Constants, Utilities, device_probe, generate_smbios
|
||||
from resources import constants, Utilities, device_probe, generate_smbios
|
||||
from data import smbios_data, bluetooth_data, cpu_data, os_data, model_array
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class BuildOpenCore:
|
||||
def __init__(self, model, versions):
|
||||
self.model = model
|
||||
self.config = None
|
||||
self.constants: Constants.Constants = versions
|
||||
self.constants: constants.Constants = versions
|
||||
self.computer = self.constants.computer
|
||||
self.gfx0_path = None
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ except ImportError:
|
||||
except ImportError:
|
||||
raise Exception("Missing requests library!\nPlease run the following before starting OCLP:\npip3 install requests")
|
||||
|
||||
from resources import Constants, ioreg, device_probe
|
||||
from resources import constants, ioreg
|
||||
from data import sip_data
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ def amfi_status():
|
||||
return True
|
||||
|
||||
def check_kext_loaded(kext_name, os_version):
|
||||
if os_version > Constants.Constants().catalina:
|
||||
if os_version > constants.Constants().catalina:
|
||||
kext_loaded = subprocess.run(["kmutil", "showloaded", "--list-only", "--variant-suffix", "release"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
else:
|
||||
kext_loaded = subprocess.run(["kextstat", "-l"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
@@ -188,19 +188,19 @@ def patching_status(os_sip, os):
|
||||
gen6_kext = "/System/Library/Extension/AppleIntelHDGraphics.kext"
|
||||
gen7_kext = "/System/Library/Extension/AppleIntelHD3000Graphics.kext"
|
||||
|
||||
if os > Constants.Constants().catalina:
|
||||
if os > constants.Constants().catalina:
|
||||
amfi_enabled = amfi_status()
|
||||
else:
|
||||
# Catalina and older supports individually disabling Library Validation
|
||||
amfi_enabled = False
|
||||
|
||||
if get_nvram("HardwareModel", "94B73556-2197-4702-82A8-3E1337DAFBFB", decode=False) not in Constants.Constants.sbm_values:
|
||||
if get_nvram("HardwareModel", "94B73556-2197-4702-82A8-3E1337DAFBFB", decode=False) not in constants.Constants.sbm_values:
|
||||
sbm_enabled = False
|
||||
|
||||
if get_nvram("csr-active-config", decode=False) and csr_decode(get_nvram("csr-active-config", decode=False), os_sip) is False:
|
||||
sip_enabled = False
|
||||
|
||||
if os > Constants.Constants().catalina and not check_filevault_skip():
|
||||
if os > constants.Constants().catalina and not check_filevault_skip():
|
||||
# Assume non-OCLP Macs do not have our APFS seal patch
|
||||
fv_status: str = subprocess.run("fdesetup status".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
|
||||
if "FileVault is Off" in fv_status:
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
from __future__ import print_function
|
||||
import subprocess
|
||||
|
||||
from resources import Constants, Utilities, defaults, sys_patch
|
||||
from resources import constants, Utilities, defaults, sys_patch
|
||||
from data import cpu_data, smbios_data, model_array
|
||||
|
||||
|
||||
class MenuOptions:
|
||||
def __init__(self, model, versions):
|
||||
self.model = model
|
||||
self.constants: Constants.Constants = versions
|
||||
self.constants: constants.Constants() = versions
|
||||
|
||||
def change_verbose(self):
|
||||
Utilities.cls()
|
||||
|
||||
@@ -11,14 +11,14 @@ import subprocess
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
from resources import Constants, device_probe, Utilities
|
||||
from resources import constants, device_probe, Utilities
|
||||
from data import sip_data, sys_patch_data, model_array
|
||||
|
||||
|
||||
class PatchSysVolume:
|
||||
def __init__(self, model, versions):
|
||||
self.model = model
|
||||
self.constants: Constants.Constants = versions
|
||||
self.constants: constants.Constants() = versions
|
||||
self.computer = self.constants.computer
|
||||
self.root_mount_path = None
|
||||
self.sip_enabled = True
|
||||
|
||||
Reference in New Issue
Block a user