From 7081db294c817db37e6db472bd5e15c670bdcdd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 20 Apr 2023 20:23:18 +0200 Subject: [PATCH] =?UTF-8?q?ukify:=20PeError=20=E2=86=92=20PEError?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't lowercase acronyms in systemd usually. Remove unnused f'' prefix to avoid a pylint warning. --- src/ukify/ukify.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index 033acba3d7f..abf34ed071a 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -44,15 +44,15 @@ import pefile __version__ = '{{PROJECT_VERSION}} ({{GIT_VERSION}})' EFI_ARCH_MAP = { - # host_arch glob : [efi_arch, 32_bit_efi_arch if mixed mode is supported] - 'x86_64' : ['x64', 'ia32'], - 'i[3456]86' : ['ia32'], - 'aarch64' : ['aa64'], - 'arm[45678]*l' : ['arm'], - 'loongarch32' : ['loongarch32'], - 'loongarch64' : ['loongarch64'], - 'riscv32' : ['riscv32'], - 'riscv64' : ['riscv64'], + # host_arch glob : [efi_arch, 32_bit_efi_arch if mixed mode is supported] + 'x86_64' : ['x64', 'ia32'], + 'i[3456]86' : ['ia32'], + 'aarch64' : ['aa64'], + 'arm[45678]*l' : ['arm'], + 'loongarch32' : ['loongarch32'], + 'loongarch64' : ['loongarch64'], + 'riscv32' : ['riscv32'], + 'riscv64' : ['riscv64'], } EFI_ARCHES: list[str] = sum(EFI_ARCH_MAP.values(), []) @@ -451,7 +451,7 @@ def pairwise(iterable): return zip(a, b) -class PeError(Exception): +class PEError(Exception): pass @@ -493,12 +493,12 @@ def pe_add_sections(uki: UKI, output: str): warnings = pe.get_warnings() if warnings: - raise PeError(f'pefile warnings treated as errors: {warnings}') + raise PEError(f'pefile warnings treated as errors: {warnings}') security = pe.OPTIONAL_HEADER.DATA_DIRECTORY[pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_SECURITY']] if security.VirtualAddress != 0: # We could strip the signatures, but why would anyone sign the stub? - raise PeError(f'Stub image is signed, refusing.') + raise PEError('Stub image is signed, refusing.') for section in uki.sections: new_section = pefile.SectionStructure(pe.__IMAGE_SECTION_HEADER_format__, pe=pe) @@ -506,7 +506,7 @@ def pe_add_sections(uki: UKI, output: str): offset = pe.sections[-1].get_file_offset() + new_section.sizeof() if offset + new_section.sizeof() > pe.OPTIONAL_HEADER.SizeOfHeaders: - raise PeError(f'Not enough header space to add section {section.name}.') + raise PEError(f'Not enough header space to add section {section.name}.') data = section.content.read_bytes()