mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 22:20:53 +10:00
build.py: Consolidate plist clean up into single loop
This commit is contained in:
+13
-22
@@ -1351,28 +1351,19 @@ class BuildOpenCore:
|
|||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
print("- Cleaning up files")
|
print("- Cleaning up files")
|
||||||
# Remove unused entries
|
# Remove unused entries
|
||||||
# TODO: Consolidate into a single for loop
|
entries_to_clean = {
|
||||||
for entry in list(self.config["ACPI"]["Add"]):
|
"ACPI": ["Add", "Delete", "Patch"],
|
||||||
if not entry["Enabled"]:
|
"Booter": ["Patch"],
|
||||||
self.config["ACPI"]["Add"].remove(entry)
|
"Kernel": ["Add", "Block", "Force", "Patch"],
|
||||||
for entry in list(self.config["ACPI"]["Patch"]):
|
"Misc": ["Tools"],
|
||||||
if not entry["Enabled"]:
|
"UEFI": ["Drivers"],
|
||||||
self.config["ACPI"]["Patch"].remove(entry)
|
}
|
||||||
for entry in list(self.config["Booter"]["Patch"]):
|
|
||||||
if not entry["Enabled"]:
|
for entry in entries_to_clean:
|
||||||
self.config["Booter"]["Patch"].remove(entry)
|
for sub_entry in entries_to_clean[entry]:
|
||||||
for entry in list(self.config["Kernel"]["Add"]):
|
for item in list(self.config[entry][sub_entry]):
|
||||||
if not entry["Enabled"]:
|
if item["Enabled"] is False:
|
||||||
self.config["Kernel"]["Add"].remove(entry)
|
self.config[entry][sub_entry].remove(item)
|
||||||
for entry in list(self.config["Kernel"]["Patch"]):
|
|
||||||
if not entry["Enabled"]:
|
|
||||||
self.config["Kernel"]["Patch"].remove(entry)
|
|
||||||
for entry in list(self.config["Misc"]["Tools"]):
|
|
||||||
if not entry["Enabled"]:
|
|
||||||
self.config["Misc"]["Tools"].remove(entry)
|
|
||||||
for entry in list(self.config["UEFI"]["Drivers"]):
|
|
||||||
if not entry["Enabled"]:
|
|
||||||
self.config["UEFI"]["Drivers"].remove(entry)
|
|
||||||
|
|
||||||
plistlib.dump(self.config, Path(self.constants.plist_path).open("wb"), sort_keys=True)
|
plistlib.dump(self.config, Path(self.constants.plist_path).open("wb"), sort_keys=True)
|
||||||
for kext in self.constants.kexts_path.rglob("*.zip"):
|
for kext in self.constants.kexts_path.rglob("*.zip"):
|
||||||
|
|||||||
Reference in New Issue
Block a user