mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-13 20:28:21 +10:00
build: Add docstrings for classes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Class for handling Bluetooth Patches, invocation from build.py
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
import logging
|
||||
|
||||
@@ -9,6 +9,11 @@ from data import smbios_data, bluetooth_data
|
||||
|
||||
|
||||
class BuildBluetooth:
|
||||
"""
|
||||
Build Library for Bluetooth Support
|
||||
|
||||
Invoke from build.py
|
||||
"""
|
||||
|
||||
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||
self.model: str = model
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Class for generating OpenCore Configurations tailored for Macs
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
import copy
|
||||
import pickle
|
||||
@@ -23,7 +23,11 @@ def rmtree_handler(func, path, exc_info) -> None:
|
||||
|
||||
|
||||
class BuildOpenCore:
|
||||
|
||||
"""
|
||||
Core Build Library for generating and validating OpenCore EFI Configurations
|
||||
compatible with genuine Macs
|
||||
"""
|
||||
|
||||
def __init__(self, model: str, global_constants: constants.Constants) -> None:
|
||||
self.model: str = model
|
||||
self.config: dict = None
|
||||
@@ -137,7 +141,7 @@ class BuildOpenCore:
|
||||
# Generate OpenCore Configuration
|
||||
self._build_efi()
|
||||
if self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True or (self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != ""):
|
||||
smbios.BuildSMBIOS(self.model, self.constants, self.config)._set_smbios()
|
||||
smbios.BuildSMBIOS(self.model, self.constants, self.config).set_smbios()
|
||||
support.BuildSupport(self.model, self.constants, self.config).cleanup()
|
||||
self._save_config()
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Class for handling CPU and Firmware Patches, invocation from build.py
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
import shutil
|
||||
import logging
|
||||
@@ -13,6 +13,11 @@ from data import smbios_data, cpu_data
|
||||
|
||||
|
||||
class BuildFirmware:
|
||||
"""
|
||||
Build Library for CPU and Firmware Support
|
||||
|
||||
Invoke from build.py
|
||||
"""
|
||||
|
||||
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||
self.model: str = model
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Class for handling Graphics and Audio Patches, invocation from build.py
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
import shutil
|
||||
import logging
|
||||
@@ -13,6 +13,11 @@ from data import smbios_data, model_array, os_data, cpu_data, video_bios_data
|
||||
|
||||
|
||||
class BuildGraphicsAudio:
|
||||
"""
|
||||
Build Library for Graphics and Audio Support
|
||||
|
||||
Invoke from build.py
|
||||
"""
|
||||
|
||||
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||
self.model: str = model
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Class for handling Misc Patches, invocation from build.py
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
import shutil
|
||||
import logging
|
||||
@@ -13,6 +13,11 @@ from data import model_array, smbios_data, cpu_data
|
||||
|
||||
|
||||
class BuildMiscellaneous:
|
||||
"""
|
||||
Build Library for Miscellaneous Hardware and Software Support
|
||||
|
||||
Invoke from build.py
|
||||
"""
|
||||
|
||||
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||
self.model: str = model
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Class for handling Wired Networking Patches, invocation from build.py
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
from resources import constants, device_probe
|
||||
from resources.build import support
|
||||
@@ -7,6 +7,11 @@ from data import smbios_data, cpu_data
|
||||
|
||||
|
||||
class BuildWiredNetworking:
|
||||
"""
|
||||
Build Library for Wired Networking Support
|
||||
|
||||
Invoke from build.py
|
||||
"""
|
||||
|
||||
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||
self.model: str = model
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Class for handling Wireless Networking Patches, invocation from build.py
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
import logging
|
||||
|
||||
@@ -9,6 +9,11 @@ from data import smbios_data
|
||||
|
||||
|
||||
class BuildWirelessNetworking:
|
||||
"""
|
||||
Build Library for Wireless Networking Support
|
||||
|
||||
Invoke from build.py
|
||||
"""
|
||||
|
||||
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||
self.model: str = model
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Class for handling macOS Security Patches, invocation from build.py
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
import logging
|
||||
import binascii
|
||||
@@ -9,6 +9,11 @@ from resources.build import support
|
||||
|
||||
|
||||
class BuildSecurity:
|
||||
"""
|
||||
Build Library for Security Patch Support
|
||||
|
||||
Invoke from build.py
|
||||
"""
|
||||
|
||||
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||
self.model: str = model
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Class for handling SMBIOS Patches, invocation from build.py
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
import ast
|
||||
import uuid
|
||||
@@ -16,6 +16,11 @@ from data import smbios_data, cpu_data, model_array
|
||||
|
||||
|
||||
class BuildSMBIOS:
|
||||
"""
|
||||
Build Library for SMBIOS Support
|
||||
|
||||
Invoke from build.py
|
||||
"""
|
||||
|
||||
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||
self.model: str = model
|
||||
@@ -56,7 +61,11 @@ class BuildSMBIOS:
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -no_compat_check"
|
||||
|
||||
|
||||
def _set_smbios(self) -> None:
|
||||
def set_smbios(self) -> None:
|
||||
"""
|
||||
SMBIOS Handler
|
||||
"""
|
||||
|
||||
spoofed_model = self.model
|
||||
|
||||
if self.constants.override_smbios == "Default":
|
||||
@@ -193,6 +202,16 @@ class BuildSMBIOS:
|
||||
|
||||
|
||||
def _minimal_serial_patch(self) -> None:
|
||||
"""
|
||||
Minimal SMBIOS Spoofing Handler
|
||||
|
||||
This function will only spoof the following:
|
||||
- Board ID
|
||||
- Firmware Features
|
||||
- BIOS Version
|
||||
- Serial Numbers (if override requested)
|
||||
"""
|
||||
|
||||
# Generate Firmware Features
|
||||
fw_feature = generate_smbios.generate_fw_features(self.model, self.constants.custom_model)
|
||||
# fw_feature = self.patch_firmware_feature()
|
||||
@@ -248,6 +267,12 @@ class BuildSMBIOS:
|
||||
|
||||
|
||||
def _moderate_serial_patch(self) -> None:
|
||||
"""
|
||||
Moderate SMBIOS Spoofing Handler
|
||||
|
||||
Implements a full SMBIOS replacement, however retains original serial numbers (unless override requested)
|
||||
"""
|
||||
|
||||
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
||||
self.config["PlatformInfo"]["Generic"]["ProcessorType"] = 1537
|
||||
if self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != "":
|
||||
@@ -266,6 +291,12 @@ class BuildSMBIOS:
|
||||
|
||||
|
||||
def _advanced_serial_patch(self) -> None:
|
||||
"""
|
||||
Advanced SMBIOS Spoofing Handler
|
||||
|
||||
Implements a full SMBIOS replacement, including serial numbers
|
||||
"""
|
||||
|
||||
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
||||
self.config["PlatformInfo"]["Generic"]["ProcessorType"] = 1537
|
||||
if self.constants.custom_serial_number == "" or self.constants.custom_board_serial_number == "":
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Class for handling Storage Controller Patches, invocation from build.py
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
import logging
|
||||
|
||||
@@ -9,6 +9,11 @@ from data import model_array, smbios_data, cpu_data
|
||||
|
||||
|
||||
class BuildStorage:
|
||||
"""
|
||||
Build Library for System Storage Support
|
||||
|
||||
Invoke from build.py
|
||||
"""
|
||||
|
||||
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||
self.model: str = model
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Utility class for build functions
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
import shutil
|
||||
import typing
|
||||
@@ -14,6 +14,9 @@ from resources import constants, utilities
|
||||
|
||||
|
||||
class BuildSupport:
|
||||
"""
|
||||
Support Library for build.py and related libraries
|
||||
"""
|
||||
|
||||
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||
self.model: str = model
|
||||
|
||||
Reference in New Issue
Block a user