target-version = "py39"
line-length = 109
-lint.select = ["E", "F", "I", "UP"]
+lint.select = ["E", "F", "I", "Q", "UP"]
[format]
-quote-style = "single"
+# The formatter prefers double quotes for multiline quotes,
+# Hence, let's make the formatter not change quotations.
+quote-style = "preserve"
+
+[lint.flake8-quotes]
+inline-quotes = "single"
+multiline-quotes = "single"
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='',
)
print('')
print(
- """};
+ '''};
// NOLINTNEXTLINE(misc-use-internal-linkage)
-const size_t hwids_section_len =""",
+const size_t hwids_section_len =''',
f'{len(hwids)};',
)
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()
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):
with p.open('rt') as f:
process_source_file(f)
-print(""" {}
+print(''' {}
};
static int sort_callback(const void *a, const void *b) {
}
return n_error == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
-}""")
+}''')
)
cmd = [
tool,
- "sign",
+ 'sign',
'--private-key', opts.sb_key,
'--certificate', opts.sb_cert,
*(
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:
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())),
from types import FrameType
from typing import Optional
-EMERGENCY_EXIT_DROPIN = """\
+EMERGENCY_EXIT_DROPIN = '''\
[Unit]
Wants=emergency-exit.service
-"""
+'''
-EMERGENCY_EXIT_SERVICE = """\
+EMERGENCY_EXIT_SERVICE = '''\
[Unit]
DefaultDependencies=no
Conflicts=shutdown.target
[Service]
ExecStart=false
-"""
+'''
@dataclasses.dataclass(frozen=True)
name = args.name + (f'-{i}' if (i := os.getenv('MESON_TEST_ITERATION')) else '')
dropin = textwrap.dedent(
- """\
+ '''\
[Service]
StandardOutput=journal+console
- """
+ '''
)
if not shell:
dropin += textwrap.dedent(
- """
+ '''
[Unit]
SuccessAction=exit
SuccessActionExitStatus=123
- """
+ '''
)
if os.getenv('TEST_MATCH_SUBTEST'):
dropin += textwrap.dedent(
- f"""
+ f'''
[Service]
Environment=TEST_MATCH_SUBTEST={os.environ['TEST_MATCH_SUBTEST']}
- """
+ '''
)
if os.getenv('TEST_MATCH_TESTCASE'):
dropin += textwrap.dedent(
- f"""
+ f'''
[Service]
Environment=TEST_MATCH_TESTCASE={os.environ['TEST_MATCH_TESTCASE']}
- """
+ '''
)
if os.getenv('TEST_RUN_DFUZZER'):
dropin += textwrap.dedent(
- f"""
+ f'''
[Service]
Environment=TEST_RUN_DFUZZER={os.environ['TEST_RUN_DFUZZER']}
- """
+ '''
)
if os.getenv('TEST_JOURNAL_USE_TMP', '0') == '1':
if not sys.stdin.isatty():
dropin += textwrap.dedent(
- """
+ '''
[Unit]
FailureAction=exit
- """
+ '''
)
elif not shell:
dropin += textwrap.dedent(
- """
+ '''
[Unit]
Wants=multi-user.target getty-pre.target
Before=getty-pre.target
IgnoreSIGPIPE=no
# bash ignores SIGTERM
KillSignal=SIGHUP
- """
+ '''
)
if sys.stdin.isatty():
dropin += textwrap.dedent(
- """
+ '''
[Service]
ExecStartPre=/usr/lib/systemd/tests/testdata/integration-test-setup.sh setup
ExecStopPost=/usr/lib/systemd/tests/testdata/integration-test-setup.sh finalize
StateDirectory=%N
- """
+ '''
)
if args.rtc: