|
30 | 30 | 'John P. Rouillard <[email protected]>': |
31 | 31 | ['rouilj'], |
32 | 32 | } |
| 33 | +ROBOTS = [ 'No Author <[email protected]>'] |
33 | 34 | # /-- |
34 | 35 |
|
35 | 36 |
|
@@ -93,11 +94,15 @@ def compress(years): |
93 | 94 | years = {} # year -> set(author1, author2, ...) |
94 | 95 | names = {} # author -> set(years) |
95 | 96 | for year, author in authorship: |
| 97 | + if author in ROBOTS: |
| 98 | + continue |
96 | 99 | # process aliases |
97 | 100 | for name, aliases in ALIASES.items(): |
98 | 101 | if author in aliases: |
99 | 102 | author = name |
100 | 103 | break |
| 104 | + author = author.replace('<', '(') |
| 105 | + author = author.replace('>', ')') |
101 | 106 | # years |
102 | 107 | if not year in years: |
103 | 108 | years[year] = set() |
@@ -134,19 +139,21 @@ def first_year(name): |
134 | 139 | def year_cmp(name1, name2): |
135 | 140 | """ |
136 | 141 | Year comparison function. First sort by latest contribution year (desc). |
137 | | - If it matches, compare first contribution year (desc). |
| 142 | + If it matches, compare first contribution year (asc). This ensures that |
| 143 | + the most recent and long-term contributors are at the top. |
138 | 144 | """ |
139 | 145 | if last_year(name1) != last_year(name2): |
140 | 146 | return last_year(name1) - last_year(name2) |
141 | 147 | else: |
142 | | - return first_year(name1) - first_year(name2) |
| 148 | + return first_year(name2) - first_year(name1) |
143 | 149 |
|
| 150 | + print("Copyright (c)") |
144 | 151 | for author in sorted(list(names), cmp=year_cmp, reverse=True): |
145 | 152 | years = list(names[author]) |
146 | 153 | yearstr = compress(years) |
147 | 154 |
|
148 | 155 | if 0: #DEBUG |
149 | 156 | print(years, yearstr, author) |
150 | 157 | else: |
151 | | - print("Copyright (c) %s %s" % (yearstr, author)) |
| 158 | + print(" %s %s" % (yearstr, author)) |
152 | 159 | print('') |
0 commit comments