forked from PyAV-Org/PyAV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AUTHORS.py
100 lines (78 loc) · 2.76 KB
/
AUTHORS.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import math
import subprocess
print('''Contributors
============
All contributors (by number of commits):
''')
email_map = {
# Maintainers.
# Junk.
'mark@mark-VirtualBox.(none)': None,
# Aliases.
}
name_map = {
'[email protected]': 'Casper van der Wel',
'[email protected]': 'Dan Allan',
'[email protected]': 'Manuel Goacolou',
'[email protected]': 'Mark Reid',
'[email protected]': 'Moritz Kassner',
'[email protected]': 'Vidar Tonaas Fauske',
'[email protected]': 'Xinran Xu',
}
github_map = {
'[email protected]': 'billyshambrook',
'[email protected]': 'danielballan',
'[email protected]': 'adavoudi',
'[email protected]': 'mikeboers',
'[email protected]': 'jlaine',
'[email protected]': 'litterfeldt',
'[email protected]': 'markreidvfx',
'[email protected]': 'mkassner',
'[email protected]': 'radek-senfeld',
'[email protected]': 'brendanlong',
'[email protected]': 'tacaswell',
'[email protected]': 'rawler',
'[email protected]': 'vidartf',
'[email protected]': 'willpatera',
'[email protected]': 'xxr3376',
}
email_count = {}
for line in subprocess.check_output(['git', 'log', '--format=%aN,%aE']).decode().splitlines():
name, email = line.strip().rsplit(',', 1)
email = email_map.get(email, email)
if not email:
continue
names = name_map.setdefault(email, set())
if isinstance(names, set):
names.add(name)
email_count[email] = email_count.get(email, 0) + 1
last = None
block_i = 0
for email, count in sorted(email_count.items(), key=lambda x: (-x[1], x[0])):
# This is the natural log, because of course it should be. ;)
order = int(math.log(count))
if last and last != order:
block_i += 1
print()
last = order
names = name_map[email]
if isinstance(names, set):
name = ', '.join(sorted(names))
else:
name = names
github = github_map.get(email)
# The '-' vs '*' is so that Sphinx treats them as different lists, and
# introduces a gap bettween them.
if github:
print('%s %s <%s>; `@%s <https://github.com/%s>`_' % ('-*'[block_i % 2], name, email, github, github))
else:
print('%s %s <%s>' % ('-*'[block_i % 2], name, email, ))