Mercurial > kallithea
comparison scripts/update-copyrights.py @ 8215:928bc1d8b279 default-i18n
Merge from default
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 06 Feb 2020 01:19:23 +0100 |
parents | f9988201a3c4 |
children | e63bcce18fef |
comparison
equal
deleted
inserted
replaced
8214:460e7d2d1b38 | 8215:928bc1d8b279 |
---|---|
1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python3 |
2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
3 | 3 |
4 """ | 4 """ |
5 Kallithea script for maintaining contributor lists from version control | 5 Kallithea script for maintaining contributor lists from version control |
6 history. | 6 history. |
40 | 40 |
41 import os | 41 import os |
42 import re | 42 import re |
43 from collections import defaultdict | 43 from collections import defaultdict |
44 | 44 |
45 import contributor_data | 45 from . import contributor_data |
46 | 46 |
47 | 47 |
48 def sortkey(x): | 48 def sortkey(x): |
49 """Return key for sorting contributors "fairly": | 49 """Return key for sorting contributors "fairly": |
50 * latest contribution | 50 * latest contribution |
51 * first contribution | 51 * first contribution |
52 * number of contribution years | 52 * number of contribution years |
53 * name (with some unicode normalization) | 53 * name (with some unicode normalization) |
54 The entries must be 2-tuples of a list of string years and the unicode name""" | 54 The entries must be 2-tuples of a list of string years and the name""" |
55 return (x[0] and -int(x[0][-1]), | 55 return (x[0] and -int(x[0][-1]), |
56 x[0] and int(x[0][0]), | 56 x[0] and int(x[0][0]), |
57 -len(x[0]), | 57 -len(x[0]), |
58 x[1].decode('utf-8').lower().replace(u'\xe9', u'e').replace(u'\u0142', u'l') | 58 x[1].decode('utf-8').lower().replace(u'\xe9', u'e').replace(u'\u0142', u'l') |
59 ) | 59 ) |
98 name_years = defaultdict(set) | 98 name_years = defaultdict(set) |
99 | 99 |
100 for year, name in all_entries: | 100 for year, name in all_entries: |
101 if name in no_entries or (name, year) in no_entries: | 101 if name in no_entries or (name, year) in no_entries: |
102 continue | 102 continue |
103 parts = name.split(' <', 1) | |
104 if len(parts) == 2: | |
105 name = parts[0] + ' <' + parts[1].lower() | |
103 domain = name.split('@', 1)[-1].rstrip('>') | 106 domain = name.split('@', 1)[-1].rstrip('>') |
104 if domain in domain_extra: | 107 if domain in domain_extra: |
105 name_years[domain_extra[domain]].add(year) | 108 name_years[domain_extra[domain]].add(year) |
106 name_years[normalize_name(name)].add(year) | 109 name_years[normalize_name(name)].add(year) |
107 | 110 |