1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 16:21:26 +03:00

Merge pull request #18745 from keszybz/stop-using-fstrings

Stop using fstrings
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-02-23 01:10:38 +01:00 committed by GitHub
commit 267294e08d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -1,7 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
"Generate %-from-name.gperf from %-list.txt" """Generate %-from-name.gperf from %-list.txt
"""
import sys import sys
@ -13,12 +14,12 @@ print("""\
_Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"") _Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
#endif #endif
%}""") %}""")
print(f"""\ print("""\
struct {name}_name {{ const char* name; int id; }}; struct {}_name {{ const char* name; int id; }};
%null-strings %null-strings
%%""") %%""".format(name))
for line in open(input): for line in open(input):
line = line.rstrip() line = line.rstrip()
s = line.replace('_', '-') s = line.replace('_', '-')
print(f'{s}, {prefix}{line}') print("{}, {}{}".format(s, prefix, line))

View File

@ -18,9 +18,9 @@ for line in open(sys.argv[1]):
if match: if match:
s = match.group(1) s = match.group(1)
if s == 'sd_bus_object_vtable_format': if s == 'sd_bus_object_vtable_format':
print(f' &{s},') print(' &{},'.format(s))
else: else:
print(f' {s},') print(' {},'.format(s))
print('''}; print('''};