updates on developer information (parsing with lark)

This commit is contained in:
Trilarion
2020-02-03 15:50:24 +01:00
parent 10625a854a
commit eeb20a670a
66 changed files with 354 additions and 104 deletions

View File

@ -739,8 +739,8 @@ def export_primary_code_repositories_json(infos):
for domain in ('repo.or.cz', 'anongit.kde.org', 'bitbucket.org', 'git.code.sf.net', 'git.savannah', 'git.tuxfamily', 'github.com', 'gitlab.com', 'gitlab.com/osgames', 'gitlab.gnome.org'):
print('{} on {}'.format(sum(1 if domain in x else 0 for x in git_repos), domain))
# write them to tools/git
json_path = os.path.join(c.root_path, 'tools', 'archives.json')
# write them to code/git
json_path = os.path.join(c.root_path, 'code', 'archives.json')
text = json.dumps(primary_repos, indent=1)
utils.write_text(json_path, text)
@ -768,8 +768,8 @@ def export_git_code_repositories_json():
# sort them alphabetically (and remove duplicates)
urls.sort()
# write them to tools/git
json_path = os.path.join(c.root_path, 'tools', 'git_repositories.json')
# write them to code/git
json_path = os.path.join(c.root_path, 'code', 'git_repositories.json')
text = json.dumps(urls, indent=1)
utils.write_text(json_path, text)
@ -789,7 +789,7 @@ def sort_text_file(file, name):
def clean_backlog(stripped_game_urls):
# read backlog and split
file = os.path.join(c.root_path, 'tools', 'backlog.txt')
file = os.path.join(c.root_path, 'code', 'backlog.txt')
text = utils.read_text(file)
text = text.split('\n')
@ -809,7 +809,7 @@ def check_validity_backlog():
import requests
# read backlog and split
file = os.path.join(c.root_path, 'tools', 'backlog.txt')
file = os.path.join(c.root_path, 'code', 'backlog.txt')
text = utils.read_text(file)
urls = text.split('\n')
urls = [x.split(' ')[0] for x in urls]
@ -835,9 +835,6 @@ def update_inspirations(infos):
print('update inspirations')
inspirations_file = os.path.join(c.root_path, 'inspirations.md')
inspirations = '[comment]: # (partly autogenerated content, edit with care, read the manual before)\n# Inspirations\n\n'
# collect information
originals = {}
for info in infos:
@ -852,8 +849,9 @@ def update_inspirations(infos):
else:
originals[original] = [name]
# number of inspirations
inspirations += '{} games listed as inspirations.\n\n'.format(len(originals))
inspirations_file = os.path.join(c.root_path, 'inspirations.md')
inspirations = '[comment]: # (partly autogenerated content, edit with care, read the manual before)\n'
inspirations += '# Inspirations ({})\n\n'.format(len(originals)) # add number of inspirations
# iterate through originals alphabetically sorted
for original, names in sorted(originals.items(), key=lambda x: str.casefold(x[0])):
@ -871,9 +869,6 @@ def update_developer(infos):
print('update developer')
developer_file = os.path.join(c.root_path, 'developer.md')
content = '[comment]: # (partly autogenerated content, edit with care, read the manual before)\n# Developer\n\n'
# collect information
developer = {}
for info in infos:
@ -886,8 +881,9 @@ def update_developer(infos):
else:
developer[dev] = [name]
# number of developers
content += '{} listed developer(s).\n\n'.format(len(developer))
developer_file = os.path.join(c.root_path, 'developer.md')
content = '[comment]: # (partly autogenerated content, edit with care, read the manual before)\n'
content += '# Developer ({})\n\n'.format(len(developer)) # add number of developer
# iterate through developers alphabetically sorted
for dev, names in sorted(developer.items(), key=lambda x: str.casefold(x[0])):
@ -936,7 +932,7 @@ if __name__ == "__main__":
# backlog
game_urls = osg.extract_links()
text = utils.read_text(os.path.join(c.root_path, 'tools', 'rejected.txt'))
text = utils.read_text(os.path.join(c.root_path, 'code', 'rejected.txt'))
regex = re.compile(r"\((http.*?)\)", re.MULTILINE)
matches = regex.findall(text)
rejected_urls = []
@ -992,5 +988,5 @@ if __name__ == "__main__":
# check_validity_external_links()
# sort backlog and rejected
# sort_text_file(os.path.join(c.root_path, 'tools', 'backlog.txt'), 'backlog')
sort_text_file(os.path.join(c.root_path, 'tools', 'rejected.txt'), 'rejected games list')
# sort_text_file(os.path.join(c.root_path, 'code', 'backlog.txt'), 'backlog')
sort_text_file(os.path.join(c.root_path, 'code', 'rejected.txt'), 'rejected games list')