Revert "generate-dns_type-gperf: modernize python syntax"

This reverts commit b0a336a669.

Fixes #18708.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-02-22 22:42:01 +01:00
parent 1f9441a72b
commit f2ec239c2b

View file

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