import developer information from github
This commit is contained in:
@ -9,6 +9,24 @@ from utils import constants as c, utils, osg, osg_parse, osg_github
|
||||
gh_entries_file = os.path.join(c.code_path, 'github_entries.txt')
|
||||
prefix = 'https://github.com/'
|
||||
|
||||
blog_alias = {'http://k776.tumblr.com/': 'https://k776.tumblr.com/', 'http://timpetricola.com': 'https://timpetricola.com',
|
||||
'http:/code.schwitzer.ca': 'https://code.schwitzer.ca/', 'http:\\www.vampier.net': 'https://www.vampier.net/'}
|
||||
ignored_blogs = ('https://uto.io',)
|
||||
|
||||
ignored_languages = ('CSS', 'HTML', 'CMake', 'XSLT', 'ShaderLab')
|
||||
language_aliases = {'VBA': 'Visual Basic', 'Common Lisp': 'Lisp', 'Game Maker Language': 'Game Maker Script', 'NewLisp': 'Lisp'}
|
||||
|
||||
ignored_repos = ('https://github.com/jtc0de/Blitwizard.git','https://github.com/IceReaper/KKnD.git',
|
||||
'https://github.com/KaidemonLP/Open-Fortress-Source.git', 'https://github.com/danielcrenna/TrueCraft.git')
|
||||
|
||||
name_aliases = {'Andreas Rosdal': 'Andreas Røsdal', 'davefancella': 'Dave Fancella', 'himiloshpetrov': 'Milosh Petrov',
|
||||
'Jeremy Monin': 'Jeremy D. Monin', 'lennertclaeys': 'Lennert Claeys', 'malignantmanor': 'Malignant Manor',
|
||||
'turulomio': 'Turulomio', '_Shaman': 'Shaman', 'alexandreSalconiDenis': 'Alexandre Salconi-Denis',
|
||||
'buginator': 'Buginator', 'CiprianKhlud': 'Ciprian Khlud', 'dericpage': 'Deric Page',
|
||||
'DI Murat Sari': 'Murat Sari', 'DolceTriade': 'Dolce Triade', 'DreamingPsion': 'Dreaming Psion',
|
||||
'edwardlii': 'Edward Lii', 'erik-vos': 'Erik Vos', 'joevenzon': 'Joe Venzon', 'noamgat': 'Noam Gat',
|
||||
'Dr. Martin Brumm': 'Martin Brumm'}
|
||||
|
||||
|
||||
def collect_github_entries():
|
||||
"""
|
||||
@ -36,6 +54,8 @@ def github_import():
|
||||
|
||||
:return:
|
||||
"""
|
||||
private_properties = json.loads(utils.read_text(c.private_properties_file))
|
||||
|
||||
files = json.loads(utils.read_text(gh_entries_file))
|
||||
|
||||
all_developers = osg.read_developers()
|
||||
@ -51,10 +71,14 @@ def github_import():
|
||||
entry = osg.read_entry(file)
|
||||
code_repositories = entry['Code repository']
|
||||
repos = [x.value for x in code_repositories if x.startswith(prefix)]
|
||||
repos[0] += ' @add'
|
||||
repos = [x for x in repos if '@add' in x]
|
||||
repos = [x.split(' ')[0] for x in repos]
|
||||
repos = [x for x in repos if x not in ignored_repos]
|
||||
for repo in repos:
|
||||
print(' GH repo {}'.format(repo))
|
||||
|
||||
info = osg_github.retrieve_repo_info(repo)
|
||||
info = osg_github.retrieve_repo_info(repo, private_properties['github-token'])
|
||||
|
||||
new_comments = []
|
||||
# is archived
|
||||
@ -75,18 +99,24 @@ def github_import():
|
||||
|
||||
# update comment
|
||||
for r in code_repositories:
|
||||
if r.value == repo:
|
||||
if r.value.startswith(repo):
|
||||
break
|
||||
comments = r.comment
|
||||
if comments:
|
||||
comments = comments.split(',')
|
||||
comments = [c.strip() for c in comments if not c.startswith('@')]
|
||||
r.comment = ', '.join(comments + new_comments)
|
||||
comments = [c.strip() for c in comments]
|
||||
comments = [c for c in comments if not c.startswith('@')] # delete old ones
|
||||
comments += new_comments
|
||||
else:
|
||||
comments = new_comments
|
||||
r.comment = ', '.join(comments)
|
||||
|
||||
# language in languages
|
||||
language = info['language']
|
||||
if language not in entry['Code language']:
|
||||
entry['Code language'].append(language)
|
||||
language = language_aliases.get(language, language)
|
||||
if language and language not in entry['Code language'] and language not in ignored_languages:
|
||||
entry['Code language'].append(osg_parse.ValueWithComment(language))
|
||||
print(' added to languages: {}'.format(language))
|
||||
|
||||
# contributors
|
||||
for contributor in info['contributors']:
|
||||
@ -98,7 +128,15 @@ def github_import():
|
||||
name = contributor.name
|
||||
if not name:
|
||||
name = contributor.login
|
||||
name = name_aliases.get(name, name)
|
||||
nickname = '{}@GH'.format(contributor.login)
|
||||
blog = contributor.blog
|
||||
if blog:
|
||||
blog = blog_alias[blog] if blog in blog_alias else blog
|
||||
if not blog.startswith('http'):
|
||||
blog = 'https://' + blog
|
||||
if blog in ignored_blogs:
|
||||
blog = None
|
||||
|
||||
# look up author in entry developers
|
||||
if name not in entry.get('Developer', []):
|
||||
@ -114,13 +152,14 @@ def github_import():
|
||||
if any(x.endswith('@GH') for x in dev.get('Contact', [])):
|
||||
print('warning: already GH contact')
|
||||
dev['Contact'] = dev.get('Contact', []) + [nickname]
|
||||
if contributor.blog and contributor.blog not in dev.get('Home', []):
|
||||
dev['Home'] = dev.get('Home', []) + [contributor.blog]
|
||||
if blog and blog not in dev.get('Home', []):
|
||||
dev['Home'] = dev.get('Home', []) + [blog]
|
||||
# TODO add to games entries!
|
||||
else:
|
||||
print(' dev "{}" ({}) added to developer database'.format(name, nickname))
|
||||
all_developers[name] = {'Name': name, 'Contact': [nickname], 'Games': [entry['Title']]}
|
||||
if contributor.blog:
|
||||
all_developers[name]['Home'] = [contributor.blog]
|
||||
if blog:
|
||||
all_developers[name]['Home'] = [blog]
|
||||
|
||||
|
||||
entry['Code repository'] = code_repositories
|
||||
|
Reference in New Issue
Block a user