mirror of
https://github.com/platomav/BIOSUtilities.git
synced 2025-05-09 13:52:00 -04:00
BIOSUtilities v24.10.06
24.10.06 Changed BIOSUtility.parse_format() to return a boolean Changed 7-Zip and EFI decompressors to return booleans Apple EFI Package Extractor support for InstallAssistant Apple EFI Image Identifier support for Apple ROM Version Added Apple EFI Image Identifier class instance attributes Improved flow of non-PATH external executable dependencies Fixed crash when attempting to clear read-only attribute Fixed incompatibility with Python versions prior to 3.12 Performance improvements when initializing BIOSUtilities Improved argument naming and definitions of "main" script Improved the README with new "main" and Apple EFI changes
This commit is contained in:
parent
4175af9eb1
commit
eda154b0f2
26 changed files with 346 additions and 223 deletions
|
@ -20,7 +20,7 @@ from biosutilities.common.paths import project_root
|
|||
from biosutilities.common.texts import to_string
|
||||
|
||||
|
||||
def get_external_path(cmd: str | list | tuple, raise_on_error: bool = True) -> str | None:
|
||||
def get_external_path(cmd: str | list | tuple) -> str:
|
||||
""" Get external dependency path (PATH environment variable or "external" directory) """
|
||||
|
||||
external_root: str = os.path.join(project_root(), 'external')
|
||||
|
@ -33,18 +33,15 @@ def get_external_path(cmd: str | list | tuple, raise_on_error: bool = True) -> s
|
|||
if command_path and os.path.isfile(path=command_path):
|
||||
return command_path
|
||||
|
||||
if raise_on_error:
|
||||
raise OSError(f'{to_string(in_object=cmd, sep_char=", ")} could not be found!')
|
||||
|
||||
return None
|
||||
raise OSError(f'{to_string(in_object=cmd, sep_char=", ")} could not be found!')
|
||||
|
||||
|
||||
def big_script_tool() -> Type | None:
|
||||
""" Get Intel BIOS Guard Script Tool class """
|
||||
|
||||
bgst: str | None = get_external_path(cmd='big_script_tool', raise_on_error=False)
|
||||
try:
|
||||
bgst: str = get_external_path(cmd='big_script_tool')
|
||||
|
||||
if bgst is not None:
|
||||
bgst_spec: ModuleSpec | None = spec_from_file_location(
|
||||
name='big_script_tool', location=re.sub(r'\.PY$', '.py', bgst))
|
||||
|
||||
|
@ -57,35 +54,37 @@ def big_script_tool() -> Type | None:
|
|||
bgst_spec.loader.exec_module(module=bgst_module)
|
||||
|
||||
return getattr(bgst_module, 'BigScript')
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def comextract_path() -> str | None:
|
||||
def comextract_path() -> str:
|
||||
""" Get ToshibaComExtractor path """
|
||||
|
||||
return get_external_path(cmd='comextract')
|
||||
|
||||
|
||||
def szip_path() -> str | None:
|
||||
def szip_path() -> str:
|
||||
""" Get 7-Zip path """
|
||||
|
||||
return get_external_path(cmd=['7zzs', '7zz', '7z'])
|
||||
|
||||
|
||||
def tiano_path() -> str | None:
|
||||
def tiano_path() -> str:
|
||||
""" Get TianoCompress path """
|
||||
|
||||
return get_external_path(cmd='TianoCompress')
|
||||
|
||||
|
||||
def uefifind_path() -> str | None:
|
||||
def uefifind_path() -> str:
|
||||
""" Get UEFIFind path """
|
||||
|
||||
return get_external_path(cmd='UEFIFind')
|
||||
|
||||
|
||||
def uefiextract_path() -> str | None:
|
||||
def uefiextract_path() -> str:
|
||||
""" Get UEFIExtract path """
|
||||
|
||||
return get_external_path(cmd='UEFIExtract')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue