Debian Codegraph @

extra/release/attribution.py

raw
1 #!/usr/bin/env python
2
3 import fileinput
4 from pprint import pprint
5
6
7 def author(line):
8 try:
9 A, E = line.strip().rsplit(None, 1)
10 E.replace('>', '').replace('<', '')
11 except ValueError:
12 A, E = line.strip(), None
13 return A.lower() if A else A, E.lower() if E else E
14
15
16 def proper_name(name):
17 return name and ' ' in name
18
19
20 def find_missing_authors(seen):
21 with open('AUTHORS') as authors:
22 known = [author(line) for line in authors.readlines()]
23
24 seen_authors = {t[0] for t in seen if proper_name(t[0])}
25 known_authors = {t[0] for t in known}
26 # maybe later?:
27 # seen_emails = {t[1] for t in seen}
28 # known_emails = {t[1] for t in known}
29
30 pprint(seen_authors - known_authors)
31
32
33 if __name__ == '__main__':
34 find_missing_authors([author(line) for line in fileinput.input()])