Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / tools / make-authors-csv.py
blob76528030fa03c70eb93e7483edeaa14cf2a5b2ac
1 #!/usr/bin/env python3
3 # Generate the authors.csv file.
5 # SPDX-License-Identifier: GPL-2.0-or-later
7 '''\
8 Remove tasks from individual author entries from the AUTHORS file
9 for use in the "About" dialog.
10 '''
12 import io
13 import re
14 import sys
17 def remove_tasks(stdinu8):
18 in_subinfo = False
19 all_lines = []
21 # Assume the first line is blank and skip it. make-authors-short.pl
22 # skipped over the UTF-8 BOM as well. Do we need to do that here?
24 stdinu8.readline()
26 for line in stdinu8:
28 sub_m = re.search(r'(.*?)\s*\{', line)
29 if sub_m:
30 in_subinfo = True
31 all_lines.append(sub_m.group(1))
32 elif '}' in line:
33 in_subinfo = False
34 nextline = next(stdinu8)
35 if not re.match(r'^\s*$', nextline):
36 # if '{' in nextline:
37 # stderru8.write("No blank line after '}', found " + nextline)
38 all_lines.append(nextline)
39 elif in_subinfo:
40 continue
41 else:
42 all_lines.append(line)
43 return all_lines
46 def main():
47 stdinu8 = io.TextIOWrapper(sys.stdin.buffer, encoding='utf8')
48 stdoutu8 = io.TextIOWrapper(sys.stdout.buffer, encoding='utf8')
49 stderru8 = io.TextIOWrapper(sys.stderr.buffer, encoding='utf8')
51 lines = remove_tasks(stdinu8)
52 patt = re.compile("(.*)[<(]([\\s'a-zA-Z0-9._%+-]+(\\[[Aa][Tt]\\])?[a-zA-Z0-9._%+-]+)[>)]")
54 for line in lines:
55 match = patt.match(line)
56 if match:
57 name = match.group(1).strip()
58 mail = match.group(2).strip().replace("[AT]", "@")
59 stdoutu8.write("{},{}\n".format(name, mail))
62 if __name__ == '__main__':
63 main()