2015-10-29 07:12:50 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""
|
|
|
|
This script will collect the contributors to friendica and its translations from
|
|
|
|
* the git log of the friendica core and addons repositories
|
|
|
|
* the translated messages.po from core and the addons.
|
2018-11-29 04:59:06 +01:00
|
|
|
The collected names will be saved in CREDITS.txt which is also parsed from
|
2015-10-29 07:12:50 +01:00
|
|
|
yourfriendica.tld/credits.
|
|
|
|
|
|
|
|
The output is not perfect, so remember to open a fresh (re)created credits.txt file
|
2015-10-29 22:10:24 +01:00
|
|
|
in your fav editor to check for obvious mistakes and doubled entries.
|
2015-10-29 07:12:50 +01:00
|
|
|
|
|
|
|
Initially written by Tobias Diekershoff for the Friendica Project. Released under
|
|
|
|
the terms of the AGPL version 3 or later, same as Friendica.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from sys import argv
|
|
|
|
import os, glob, subprocess
|
|
|
|
|
|
|
|
# a list of names to not include, those people get into the list by other names
|
|
|
|
# but they use different names on different systems and automatical mapping does
|
|
|
|
# not work in some cases.
|
|
|
|
dontinclude = ['root', 'friendica', 'bavatar', 'tony baldwin', 'Taek', 'silke m',
|
|
|
|
'leberwurscht', 'abinoam', 'fabrixxm', 'FULL NAME', 'Hauke Zuehl',
|
2019-01-14 06:57:37 +01:00
|
|
|
'Michal Supler', 'michal_s', 'Manuel Pérez', 'rabuzarus',
|
2019-01-14 07:02:05 +01:00
|
|
|
'Alberto Díaz', 'hoergen oostende', 'Friendica', 'vinzv',
|
2019-01-14 06:57:37 +01:00
|
|
|
'Vincent Vindarel']
|
2015-10-29 07:12:50 +01:00
|
|
|
|
2015-10-29 22:05:48 +01:00
|
|
|
|
2018-11-29 04:59:06 +01:00
|
|
|
# this script is in the /bin/dev directory of the friendica installation
|
2015-10-29 07:12:50 +01:00
|
|
|
# so the friendica path is the 0th argument of calling this script but we
|
|
|
|
# need to remove the name of the file and the name of the directory
|
2018-05-20 14:56:33 +02:00
|
|
|
path = os.path.abspath(argv[0].split('bin/dev/make_credits.py')[0])
|
2015-10-29 07:12:50 +01:00
|
|
|
print('> base directory is assumed to be: '+path)
|
|
|
|
# a place to store contributors
|
2017-11-26 10:58:15 +01:00
|
|
|
contributors = ["Andi Stadler", "Ratten", "Vít Šesták 'v6ak'"]
|
2015-10-29 07:12:50 +01:00
|
|
|
# get the contributors
|
|
|
|
print('> getting contributors to the friendica core repository')
|
|
|
|
p = subprocess.Popen(['git', 'shortlog', '--no-merges', '-s'],
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.STDOUT)
|
|
|
|
c = iter(p.stdout.readline, b'')
|
|
|
|
for i in c:
|
|
|
|
name = i.decode().split('\t')[1].split('\n')[0]
|
|
|
|
if not name in contributors and name not in dontinclude:
|
|
|
|
contributors.append(name)
|
|
|
|
n1 = len(contributors)
|
|
|
|
print(' > found %d contributors' % n1)
|
|
|
|
# get the contributors to the addons
|
2016-02-17 08:00:38 +01:00
|
|
|
try:
|
|
|
|
os.chdir(path+'/addon')
|
|
|
|
# get the contributors
|
|
|
|
print('> getting contributors to the addons')
|
|
|
|
p = subprocess.Popen(['git', 'shortlog', '--no-merges', '-s'],
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.STDOUT)
|
|
|
|
c = iter(p.stdout.readline, b'')
|
|
|
|
for i in c:
|
|
|
|
name = i.decode().split('\t')[1].split('\n')[0]
|
|
|
|
if not name in contributors and name not in dontinclude:
|
|
|
|
contributors.append(name)
|
|
|
|
except FileNotFoundError:
|
|
|
|
print(' > no addon directory found ( THE LIST OF CONTRIBUTORS WILL BE INCOMPLETE )')
|
2015-10-29 07:12:50 +01:00
|
|
|
n2 = len(contributors)
|
|
|
|
print(' > found %d new contributors' % (n2-n1))
|
|
|
|
print('> total of %d contributors to the repositories of friendica' % n2)
|
|
|
|
os.chdir(path)
|
|
|
|
# get the translators
|
|
|
|
print('> getting translators')
|
|
|
|
intrans = False
|
2016-09-30 16:46:56 +02:00
|
|
|
for f in glob.glob(path+'/view/lang/*/messages.po'):
|
2015-10-29 07:12:50 +01:00
|
|
|
i = open(f, 'r')
|
|
|
|
l = i.readlines()
|
|
|
|
i.close()
|
|
|
|
for ll in l:
|
|
|
|
if intrans and ll.strip()=='':
|
|
|
|
intrans = False;
|
|
|
|
if intrans and ll[0]=='#':
|
|
|
|
name = ll.split('# ')[1].split(',')[0].split(' <')[0]
|
|
|
|
if not name in contributors and name not in dontinclude:
|
|
|
|
contributors.append(name)
|
|
|
|
if "# Translators:" in ll:
|
|
|
|
intrans = True
|
|
|
|
# get the translators from the addons
|
|
|
|
for f in glob.glob(path+'/addon/*/lang/*/messages.po'):
|
|
|
|
i = open(f, 'r')
|
|
|
|
l = i.readlines()
|
|
|
|
i.close()
|
|
|
|
for ll in l:
|
|
|
|
if intrans and ll.strip()=='':
|
|
|
|
intrans = False;
|
2019-01-14 06:57:37 +01:00
|
|
|
# at this point Transifex sometimes includes a "#, fuzzy" we eill
|
|
|
|
# ignore all lines starting with "#," as they do not contains any
|
|
|
|
# "Name email, year" information.
|
|
|
|
if not "#," in ll:
|
|
|
|
if intrans and ll[0]=='#':
|
|
|
|
name = ll.split('# ')[1].split(',')[0].split(' <')[0]
|
|
|
|
if not name in contributors and name not in dontinclude:
|
|
|
|
contributors.append(name)
|
2015-10-29 07:12:50 +01:00
|
|
|
if "# Translators:" in ll:
|
|
|
|
intrans = True
|
|
|
|
# done with the translators
|
|
|
|
|
|
|
|
n3 = len(contributors)
|
|
|
|
print(' > found %d translators' % (n3-n2))
|
|
|
|
print('> found a total of %d contributors and translators' % n3)
|
|
|
|
contributors.sort(key=str.lower)
|
|
|
|
|
2018-11-29 04:59:06 +01:00
|
|
|
f = open(path+'/CREDITS.txt', 'w')
|
2015-10-29 07:12:50 +01:00
|
|
|
f.write("\n".join(contributors))
|
|
|
|
f.close()
|
2018-11-29 04:59:06 +01:00
|
|
|
print('> list saved to CREDITS.txt')
|