ruff: use single quotes for multiline strings

This commit is contained in:
Yu Watanabe
2026-05-18 02:32:39 +09:00
parent aa0f03eb03
commit c54decc406
6 changed files with 53 additions and 47 deletions
+4 -4
View File
@@ -16,13 +16,13 @@ BYTES_PER_LINE = 16
hwids = ukify.parse_hwid_dir(Path(sys.argv[1]))
print(
"""/* SPDX-License-Identifier: LGPL-2.1-or-later */
'''/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stddef.h>
#include <stdint.h>
// NOLINTNEXTLINE(misc-use-internal-linkage)
const uint8_t hwids_section_data[] = {
""",
''',
end='',
)
@@ -34,9 +34,9 @@ for i, b in enumerate(hwids):
print('')
print(
"""};
'''};
// NOLINTNEXTLINE(misc-use-internal-linkage)
const size_t hwids_section_len =""",
const size_t hwids_section_len =''',
f'{len(hwids)};',
)
+2 -2
View File
@@ -30,12 +30,12 @@ with open(header) as file:
enumName = ''
if output == 'doc':
print("""\
print('''\
<?xml version="1.0"?>
<!DOCTYPE bpf-delegates PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<para>
""")
''')
for line in file:
line = line.strip()
+12 -12
View File
@@ -120,43 +120,43 @@ def process_source_file(file: IO[str]) -> None:
continue
print("""/* SPDX-License-Identifier: LGPL-2.1-or-later */
print('''/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
""")
''')
for header in sys.argv[3:]:
with open(header, 'r') as f:
if process_header_file(f):
print('#include "{}"'.format(header.split('/')[-1]))
print("""
print('''
/* We want to check deprecated symbols too, without complaining */
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
""")
''')
print("""
print('''
struct symbol {
const char *name;
const void *symbol;
};
static struct symbol symbols_from_sym[] = {""")
static struct symbol symbols_from_sym[] = {''')
with open(sys.argv[1], 'r') as f:
process_sym_file(f)
print(""" {}
}, symbols_from_header[] = {""")
print(''' {}
}, symbols_from_header[] = {''')
for header in sys.argv[3:]:
with open(header, 'r') as f:
print(process_header_file(f), end='')
print(""" {}
}, symbols_from_source[] = {""")
print(''' {}
}, symbols_from_source[] = {''')
for dirpath, _, filenames in sorted(os.walk(sys.argv[2])):
for filename in sorted(filenames):
@@ -168,7 +168,7 @@ for dirpath, _, filenames in sorted(os.walk(sys.argv[2])):
with p.open('rt') as f:
process_source_file(f)
print(""" {}
print(''' {}
};
static int sort_callback(const void *a, const void *b) {
@@ -239,4 +239,4 @@ int main(void) {
}
return n_error == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}""")
}''')
+7 -7
View File
@@ -599,7 +599,7 @@ class SystemdSbSign(SignTool):
)
cmd = [
tool,
"sign",
'sign',
'--private-key', opts.sb_key,
'--certificate', opts.sb_cert,
*(
@@ -1305,15 +1305,15 @@ def parse_efifw_dir(path: Path) -> bytes:
return efifw_blob
STUB_SBAT = """\
STUB_SBAT = '''\
sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
uki,1,UKI,uki,1,https://uapi-group.org/specifications/specs/unified_kernel_image/
"""
'''
ADDON_SBAT = """\
ADDON_SBAT = '''\
sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
uki-addon,1,UKI Addon,addon,1,https://www.freedesktop.org/software/systemd/man/latest/systemd-stub.html
"""
'''
def make_uki(opts: UkifyConfig) -> None:
@@ -2326,11 +2326,11 @@ def create_parser() -> argparse.ArgumentParser:
p = argparse.ArgumentParser(
description='Build and sign Unified Kernel Images',
usage='\n '
+ textwrap.dedent("""\
+ textwrap.dedent('''\
ukify {b}build{e} [--linux=LINUX] [--initrd=INITRD] [options…]
ukify {b}genkey{e} [options…]
ukify {b}inspect{e} FILE… [options…]
""").format(b=Style.bold, e=Style.reset),
''').format(b=Style.bold, e=Style.reset),
allow_abbrev=False,
add_help=False,
epilog='\n '.join(('config file:', *config_example())),