Mercurial > kallithea
annotate scripts/update-copyrights.py @ 8368:e5ccabbc3cd7 stable
release: merge default to stable for 0.6.0
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Sat, 02 May 2020 21:20:43 +0200 |
parents | d6ccf6a9fd11 |
children |
rev | line source |
---|---|
8173
aa6f17a53b49
py3: switch to use Python 3 interpreter, temporarily leaving many things very broken until they have been migrated/fixed in a reviewable way
Mads Kiilerich <mads@kiilerich.com>
parents:
8161
diff
changeset
|
1 #!/usr/bin/env python3 |
6777
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 |
8308
96b43734025f
scripts: use plain import of contributor_data
Mads Kiilerich <mads@kiilerich.com>
parents:
8224
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) |
8200
f9988201a3c4
py3: some not-entirely-trivial removing of "unicode"
Mads Kiilerich <mads@kiilerich.com>
parents:
8173
diff
changeset
|
54 The entries must be 2-tuples of a list of string years and the name""" |
8310
d6ccf6a9fd11
scripts: fix crash from comparing integer with empty list
Mads Kiilerich <mads@kiilerich.com>
parents:
8309
diff
changeset
|
55 years, name = x |
d6ccf6a9fd11
scripts: fix crash from comparing integer with empty list
Mads Kiilerich <mads@kiilerich.com>
parents:
8309
diff
changeset
|
56 if not years: |
d6ccf6a9fd11
scripts: fix crash from comparing integer with empty list
Mads Kiilerich <mads@kiilerich.com>
parents:
8309
diff
changeset
|
57 years = ['0'] |
d6ccf6a9fd11
scripts: fix crash from comparing integer with empty list
Mads Kiilerich <mads@kiilerich.com>
parents:
8309
diff
changeset
|
58 return (-int(years[-1]), # primarily sort by latest contribution |
d6ccf6a9fd11
scripts: fix crash from comparing integer with empty list
Mads Kiilerich <mads@kiilerich.com>
parents:
8309
diff
changeset
|
59 int(years[0]), # then sort by first contribution |
d6ccf6a9fd11
scripts: fix crash from comparing integer with empty list
Mads Kiilerich <mads@kiilerich.com>
parents:
8309
diff
changeset
|
60 -len(years), # then sort by length of contribution (no gaps) |
d6ccf6a9fd11
scripts: fix crash from comparing integer with empty list
Mads Kiilerich <mads@kiilerich.com>
parents:
8309
diff
changeset
|
61 name.lower().replace('\xe9', 'e').replace('\u0142', 'l') # finally sort by name |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
62 ) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
63 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
64 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
65 def nice_years(l, dash='-', join=' '): |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
66 """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
|
67 if not l: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
68 return '' |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
69 start = end = int(l[0]) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
70 ranges = [] |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
71 for year in l[1:] + [0]: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
72 year = int(year) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
73 if year == end + 1: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
74 end = year |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
75 continue |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
76 if start == end: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
77 ranges.append('%s' % start) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
78 else: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
79 ranges.append('%s%s%s' % (start, dash, end)) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
80 start = end = year |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
81 assert start == 0 and end == 0, (start, end) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
82 return join.join(ranges) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
83 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
84 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
85 def insert_entries( |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
86 filename, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
87 all_entries, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
88 no_entries, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
89 domain_extra, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
90 split_re, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
91 normalize_name, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
92 format_f): |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
93 """Update file with contributor information. |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
94 all_entries: list of tuples with year and name |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
95 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
|
96 domain_extra: map domain name to extra credit name |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
97 split_re: regexp matching the part of file to rewrite |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
98 normalize_name: function to normalize names for grouping and display |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
99 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
|
100 """ |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
101 name_years = defaultdict(set) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
102 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
103 for year, name in all_entries: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
104 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
|
105 continue |
8098
27d6f56ade84
scripts: lower case contributor emails to normalize them
Mads Kiilerich <mads@kiilerich.com>
parents:
7817
diff
changeset
|
106 parts = name.split(' <', 1) |
27d6f56ade84
scripts: lower case contributor emails to normalize them
Mads Kiilerich <mads@kiilerich.com>
parents:
7817
diff
changeset
|
107 if len(parts) == 2: |
27d6f56ade84
scripts: lower case contributor emails to normalize them
Mads Kiilerich <mads@kiilerich.com>
parents:
7817
diff
changeset
|
108 name = parts[0] + ' <' + parts[1].lower() |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
109 domain = name.split('@', 1)[-1].rstrip('>') |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
110 if domain in domain_extra: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
111 name_years[domain_extra[domain]].add(year) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
112 name_years[normalize_name(name)].add(year) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
113 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
114 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
|
115 for name, years in name_years.items()] |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
116 l.sort(key=sortkey) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
117 |
6860
665dfa112f2c
py3: replace "file" with "open"
Lars Kruse <devel@sumpfralle.de>
parents:
6777
diff
changeset
|
118 with open(filename) as f: |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
119 pre, post = re.split(split_re, f.read()) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
120 |
6860
665dfa112f2c
py3: replace "file" with "open"
Lars Kruse <devel@sumpfralle.de>
parents:
6777
diff
changeset
|
121 with open(filename, 'w') as f: |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
122 f.write(pre + |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
123 ''.join(format_f(years, name) for years, name in l) + |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
124 post) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
125 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
126 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
127 def main(): |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
128 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
|
129 (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
|
130 for year, name in |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
131 (line.strip().split(' ', 1) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
132 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
|
133 ] |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
134 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
135 insert_entries( |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
136 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
|
137 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
|
138 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
|
139 domain_extra=contributor_data.domain_extra, |
8309
68bbfd164b23
scripts: in regexps, use + when we actually want to make long matches instead of empty
Mads Kiilerich <mads@kiilerich.com>
parents:
8308
diff
changeset
|
140 split_re=r'(?: <li>Copyright © [^\n]+</li>\n)+', |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
141 normalize_name=lambda name: name.split('<', 1)[0].strip(), |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
142 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
|
143 ) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
144 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
145 insert_entries( |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
146 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
|
147 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
|
148 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
|
149 domain_extra=contributor_data.domain_extra, |
8309
68bbfd164b23
scripts: in regexps, use + when we actually want to make long matches instead of empty
Mads Kiilerich <mads@kiilerich.com>
parents:
8308
diff
changeset
|
150 split_re=r'(?: [^\n]+\n)+', |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
151 normalize_name=lambda name: name, |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
152 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
|
153 ) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
154 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
155 insert_entries( |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
156 filename='kallithea/templates/base/base.html', |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
157 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
|
158 no_entries=contributor_data.total_ignore, |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
159 domain_extra={}, |
8309
68bbfd164b23
scripts: in regexps, use + when we actually want to make long matches instead of empty
Mads Kiilerich <mads@kiilerich.com>
parents:
8308
diff
changeset
|
160 split_re=r'(?<=©) .+ (?=by various authors)', |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
161 normalize_name=lambda name: '', |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
162 format_f=lambda years, name: ' ' + nice_years(years, '–', ', ') + ' ', |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
163 ) |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
164 |
7756
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
165 #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
|
166 insert_entries( |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
167 filename='docs/conf.py', |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
168 all_entries=repo_entries, |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
169 no_entries=contributor_data.total_ignore, |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
170 domain_extra={}, |
8309
68bbfd164b23
scripts: in regexps, use + when we actually want to make long matches instead of empty
Mads Kiilerich <mads@kiilerich.com>
parents:
8308
diff
changeset
|
171 split_re=r"(?<=copyright = ').+(?= by various authors)", |
7756
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
172 normalize_name=lambda name: '', |
7817
66e8dbd4b571
flake8: fix E203 whitespace before ','
Mads Kiilerich <mads@kiilerich.com>
parents:
7811
diff
changeset
|
173 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
|
174 ) |
f68db0c03a78
docs: maintain copyright year from update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7755
diff
changeset
|
175 |
6777
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
176 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
177 if __name__ == '__main__': |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
178 main() |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
179 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
180 |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
181 # To list new contributors since last tagging: |
5dde581f703f
scripts: add update-copyrights.py
Mads Kiilerich <mads@kiilerich.com>
parents:
diff
changeset
|
182 # { hg log -r '::tagged()' -T ' {author}\n {author}\n'; hg log -r '::.' -T ' {author}\n' | sort | uniq; } | sort | uniq -u |