mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-20 10:44:32 +10:00
Adjust Constants to python scheme
This commit is contained in:
@@ -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