Mercurial > kallithea
annotate scripts/update-copyrights.py @ 8044:91103995888b
tests: fix ordering of options of "ret_type must be one of ..." returned from api
Py3 would fail becauase it use another ordering.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 26 Dec 2019 05:36:00 +0100 |
parents | 66e8dbd4b571 |
children | 27d6f56ade84 |
rev | line source |
---|---|
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python2 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
3 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
4 """ |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
5 Kallithea script for maintaining contributor lists from version control |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
6 history. |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
7 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
8 This script and the data in it is a best effort attempt at reverse engineering |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
9 previous attributions and correlate that with version control history while |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
10 preserving all existing copyright statements and attribution. This script is |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
11 processing and summarizing information found elsewhere - it is not by itself |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
12 making any claims. Comments in the script are an attempt at reverse engineering |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
13 possible explanations - they are not showing any intent or confirming it is |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
14 correct. |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
15 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
16 Three files are generated / modified by this script: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
17 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
18 kallithea/templates/about.html claims to show copyright holders, and the GPL |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
19 license requires such existing "legal notices" to be preserved. We also try to |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
20 keep it updated with copyright holders, but do not claim it is a correct list. |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
21 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
22 CONTRIBUTORS has the purpose of giving credit where credit is due and list all |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
23 the contributor names in the source. |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
24 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
25 kallithea/templates/base/base.html contains the copyright years in the page |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
26 footer. |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
27 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
28 Both make a best effort of listing all copyright holders, but revision control |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
29 history might be a better and more definitive source. |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
30 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
31 Contributors are sorted "fairly" by copyright year and amount of |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
32 contribution. |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
33 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
34 New contributors are listed, without considering if the contribution contains |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
35 copyrightable work. |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
36 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
37 When the copyright might belong to a different legal entity than the |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
38 contributor, the legal entity is given credit too. |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
39 """ |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
40 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
41 import os |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
42 import re |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
43 from collections import defaultdict |
7811
0a277465fddf
scripts: initial run of import cleanup using isort
Mads Kiilerich <mads@kiilerich.com>
parents:
7756
diff
changeset
|
44 |
7584
050a94de8e7f
scripts: extract contributor data out of update-copyrights.py
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7559
diff
changeset
|
45 import contributor_data |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
46 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
47 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
48 def sortkey(x): |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
49 """Return key for sorting contributors "fairly": |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
50 * latest contribution |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
51 * first contribution |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
52 * number of contribution years |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
53 * name (with some unicode normalization) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
54 The entries must be 2-tuples of a list of string years and the unicode name""" |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
55 return (x[0] and -int(x[0][-1]), |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
56 x[0] and int(x[0][0]), |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
57 -len(x[0]), |
7328
e2519d2e74c2
unicode: consistently use the preferred Python spelling 'utf-8' instead of the alias 'utf8'
Mads Kiilerich <mads@kiilerich.com>
parents:
7320
diff
changeset
|
58 x[1].decode('utf-8').lower().replace(u'\xe9', u'e').replace(u'\u0142', u'l') |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
59 ) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
60 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
61 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
62 def nice_years(l, dash='-', join=' '): |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
63 """Convert a list of years into brief range like '1900-1901, 1921'.""" |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
64 if not l: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
65 return '' |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
66 start = end = int(l[0]) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
67 ranges = [] |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
68 for year in l[1:] + [0]: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
69 year = int(year) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
70 if year == end + 1: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
71 end = year |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
72 continue |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
73 if start == end: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
74 ranges.append('%s' % start) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
75 else: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
76 ranges.append('%s%s%s' % (start, dash, end)) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
77 start = end = year |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
78 assert start == 0 and end == 0, (start, end) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
79 return join.join(ranges) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
80 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
81 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
82 def insert_entries( |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
83 filename, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
84 all_entries, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
85 no_entries, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
86 domain_extra, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
87 split_re, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
88 normalize_name, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
89 format_f): |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
90 """Update file with contributor information. |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
91 all_entries: list of tuples with year and name |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
92 no_entries: set of names or name and year tuples to ignore |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
93 domain_extra: map domain name to extra credit name |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
94 split_re: regexp matching the part of file to rewrite |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
95 normalize_name: function to normalize names for grouping and display |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
96 format_f: function formatting year list and name to a string |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
97 """ |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
98 name_years = defaultdict(set) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
99 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
100 for year, name in all_entries: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
101 if name in no_entries or (name, year) in no_entries: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
102 continue |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
103 domain = name.split('@', 1)[-1].rstrip('>') |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
104 if domain in domain_extra: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
105 name_years[domain_extra[domain]].add(year) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
106 name_years[normalize_name(name)].add(year) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
107 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
108 l = [(list(sorted(year for year in years if year)), name) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
109 for name, years in name_years.items()] |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
110 l.sort(key=sortkey) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
111 |
6860
665dfa112f2c
py3: replace "file" with "open"
Lars Kruse <devel@sumpfralle.de>
parents:
6777
diff
changeset
|
112 with open(filename) as f: |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
113 pre, post = re.split(split_re, f.read()) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
114 |
6860
665dfa112f2c
py3: replace "file" with "open"
Lars Kruse <devel@sumpfralle.de>
parents:
6777
diff
changeset
|
115 with open(filename, 'w') as f: |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
116 f.write(pre + |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
117 ''.join(format_f(years, name) for years, name in l) + |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
118 post) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
119 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
120 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
121 def main(): |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
122 repo_entries = [ |
7584
050a94de8e7f
scripts: extract contributor data out of update-copyrights.py
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7559
diff
changeset
|
123 (year, contributor_data.name_fixes.get(name) or contributor_data.name_fixes.get(name.rsplit('<', 1)[0].strip()) or name) |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
124 for year, name in |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
125 (line.strip().split(' ', 1) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
126 for line in os.popen("""hg log -r '::.' -T '{date(date,"%Y")} {author}\n'""").readlines()) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
127 ] |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
128 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
129 insert_entries( |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
130 filename='kallithea/templates/about.html', |
7755
a44228cd208b
scripts: prepare for giving credit for contributions that have been integrated into other changesets
Mads Kiilerich <mads@kiilerich.com>
parents:
7584
diff
changeset
|
131 all_entries=repo_entries + contributor_data.other_about + contributor_data.other, |
7584
050a94de8e7f
scripts: extract contributor data out of update-copyrights.py
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7559
diff
changeset
|
132 no_entries=contributor_data.no_about, |
050a94de8e7f
scripts: extract contributor data out of update-copyrights.py
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7559
diff
changeset
|
133 domain_extra=contributor_data.domain_extra, |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
134 split_re=r'(?: <li>Copyright © [^\n]*</li>\n)*', |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
135 normalize_name=lambda name: name.split('<', 1)[0].strip(), |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
136 format_f=lambda years, name: ' <li>Copyright © %s, %s</li>\n' % (nice_years(years, '–', ', '), name), |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
137 ) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
138 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
139 insert_entries( |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
140 filename='CONTRIBUTORS', |
7755
a44228cd208b
scripts: prepare for giving credit for contributions that have been integrated into other changesets
Mads Kiilerich <mads@kiilerich.com>
parents:
7584
diff
changeset
|
141 all_entries=repo_entries + contributor_data.other_contributors + contributor_data.other, |
7584
050a94de8e7f
scripts: extract contributor data out of update-copyrights.py
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7559
diff
changeset
|
142 no_entries=contributor_data.total_ignore, |
050a94de8e7f
scripts: extract contributor data out of update-copyrights.py
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7559
diff
changeset
|
143 domain_extra=contributor_data.domain_extra, |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
144 split_re=r'(?: [^\n]*\n)*', |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
145 normalize_name=lambda name: name, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
146 format_f=lambda years, name: (' %s%s%s\n' % (name, ' ' if years else '', nice_years(years))), |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
147 ) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
148 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
149 insert_entries( |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
150 filename='kallithea/templates/base/base.html', |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
151 all_entries=repo_entries, |
7584
050a94de8e7f
scripts: extract contributor data out of update-copyrights.py
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7559
diff
changeset
|
152 no_entries=contributor_data.total_ignore, |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
153 domain_extra={}, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
154 split_re=r'(?<=©) .* (?=by various authors)', |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
155 normalize_name=lambda name: '', |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
156 format_f=lambda years, name: ' ' + nice_years(years, '–', ', ') + ' ', |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
157 ) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
158 |
7756
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
159 #docs/conf.py:copyright = u'2010-2016 by various authors, licensed as GPLv3.' |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
160 insert_entries( |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
161 filename='docs/conf.py', |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
162 all_entries=repo_entries, |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
163 no_entries=contributor_data.total_ignore, |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
164 domain_extra={}, |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
165 split_re=r"(?<=copyright = u').*(?= by various authors)", |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
166 normalize_name=lambda name: '', |
7817
66e8dbd4b571
flake8: fix E203 whitespace before ','
Mads Kiilerich <mads@kiilerich.com>
parents:
7811
diff
changeset
|
167 format_f=lambda years, name: nice_years(years, '-', ', '), |
7756
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
168 ) |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
169 |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
170 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
171 if __name__ == '__main__': |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
172 main() |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
173 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
174 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
175 # To list new contributors since last tagging: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
176 # { hg log -r '::tagged()' -T ' {author}\n {author}\n'; hg log -r '::.' -T ' {author}\n' | sort | uniq; } | sort | uniq -u |