2 # -*- coding: utf-8 -*-
5 This script will collect the contributors to friendica and its translations from
6 * the git log of the friendica core and addons repositories
7 * the translated messages.po from core and the addons.
8 The collected names will be saved in /util/credits.txt which is also parsed from
9 yourfriendica.tld/credits.
11 The output is not perfect, so remember to open a fresh (re)created credits.txt file
12 in your fav editor to check for obvious mistakes and doubled entries.
14 Initially written by Tobias Diekershoff for the Friendica Project. Released under
15 the terms of the AGPL version 3 or later, same as Friendica.
19 import os, glob, subprocess
21 # a list of names to not include, those people get into the list by other names
22 # but they use different names on different systems and automatical mapping does
23 # not work in some cases.
24 dontinclude = ['root', 'friendica', 'bavatar', 'tony baldwin', 'Taek', 'silke m',
25 'leberwurscht', 'abinoam', 'fabrixxm', 'FULL NAME', 'Hauke Zuehl',
26 'Michal Supler', 'michal_s', 'Manuel PĂ©rez']
29 # this script is in the /util sub-directory of the friendica installation
30 # so the friendica path is the 0th argument of calling this script but we
31 # need to remove the name of the file and the name of the directory
32 path = os.path.abspath(argv[0].split('util/make_credits.py')[0])
33 print('> base directory is assumed to be: '+path)
34 # a place to store contributors
35 contributors = ['Andi Stadler']
36 # get the contributors
37 print('> getting contributors to the friendica core repository')
38 p = subprocess.Popen(['git', 'shortlog', '--no-merges', '-s'],
39 stdout=subprocess.PIPE,
40 stderr=subprocess.STDOUT)
41 c = iter(p.stdout.readline, b'')
43 name = i.decode().split('\t')[1].split('\n')[0]
44 if not name in contributors and name not in dontinclude:
45 contributors.append(name)
46 n1 = len(contributors)
47 print(' > found %d contributors' % n1)
48 # get the contributors to the addons
50 os.chdir(path+'/addon')
51 # get the contributors
52 print('> getting contributors to the addons')
53 p = subprocess.Popen(['git', 'shortlog', '--no-merges', '-s'],
54 stdout=subprocess.PIPE,
55 stderr=subprocess.STDOUT)
56 c = iter(p.stdout.readline, b'')
58 name = i.decode().split('\t')[1].split('\n')[0]
59 if not name in contributors and name not in dontinclude:
60 contributors.append(name)
61 except FileNotFoundError:
62 print(' > no addon directory found ( THE LIST OF CONTRIBUTORS WILL BE INCOMPLETE )')
63 n2 = len(contributors)
64 print(' > found %d new contributors' % (n2-n1))
65 print('> total of %d contributors to the repositories of friendica' % n2)
68 print('> getting translators')
70 for f in glob.glob(path+'/view/*/messages.po'):
75 if intrans and ll.strip()=='':
77 if intrans and ll[0]=='#':
78 name = ll.split('# ')[1].split(',')[0].split(' <')[0]
79 if not name in contributors and name not in dontinclude:
80 contributors.append(name)
81 if "# Translators:" in ll:
83 # get the translators from the addons
84 for f in glob.glob(path+'/addon/*/lang/*/messages.po'):
89 if intrans and ll.strip()=='':
91 if intrans and ll[0]=='#':
92 name = ll.split('# ')[1].split(',')[0].split(' <')[0]
93 if not name in contributors and name not in dontinclude:
94 contributors.append(name)
95 if "# Translators:" in ll:
97 # done with the translators
99 n3 = len(contributors)
100 print(' > found %d translators' % (n3-n2))
101 print('> found a total of %d contributors and translators' % n3)
102 contributors.sort(key=str.lower)
104 f = open(path+'/util/credits.txt', 'w')
105 f.write("\n".join(contributors))
107 print('> list saved to util/credits.txt')