]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ukify: PeError → PEError
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 20 Apr 2023 18:23:18 +0000 (20:23 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 5 May 2023 16:42:37 +0000 (18:42 +0200)
We don't lowercase acronyms in systemd usually.
Remove unnused f'' prefix to avoid a pylint warning.

src/ukify/ukify.py

index 033acba3d7f843e92a5fdbf4ec1bbc41dbe69ff6..abf34ed071a352143465f2819ba21a3a2e20b65b 100755 (executable)
@@ -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()