1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-10 00:58:20 +03:00

generate-dns_type-gperf: modernize python syntax

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-01-27 12:16:40 +01:00
parent 7857b6e838
commit b0a336a669

View File

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