no developers for libraries (are not really gaming related)

This commit is contained in:
Trilarion
2021-03-12 16:54:01 +01:00
parent 575da53feb
commit ead0b89cff
47 changed files with 278 additions and 5334 deletions

View File

@ -4,6 +4,7 @@
"git://git.colm.net/ragel.git",
"git://opensimulator.org/git/opensim",
"http://git.pond.sub.org/empserver",
"http://hgm.nubati.net/cgi-bin/gitweb.cgi?p=fairymax.git",
"https://anongit.freedesktop.org/git/pkg-config.git",
"https://anongit.kde.org/ksudoku.git",
"https://bitbucket.org/SteveSmith16384/teamtactics.git",
@ -97,6 +98,7 @@
"https://git.net-core.org/tome/t-engine4.git",
"https://git.octaforge.org/OctaForge/OctaCore.git",
"https://git.savannah.gnu.org/git/adonthell/adonthell-wastesedge.git",
"https://git.savannah.gnu.org/git/emacs.git",
"https://git.savannah.gnu.org/git/freedink.git",
"https://git.savannah.gnu.org/git/freedink/dfarc.git",
"https://git.savannah.gnu.org/git/freedink/dink-data.git",
@ -307,6 +309,7 @@
"https://github.com/OpenDominion/OpenDominion.git",
"https://github.com/OpenDungeons/OpenDungeons.git",
"https://github.com/OpenFodder/openfodder.git",
"https://github.com/OpenHV/OpenHV.git",
"https://github.com/OpenLoco/OpenLoco.git",
"https://github.com/OpenMW/openmw.git",
"https://github.com/OpenMeridian/Meridian59.git",
@ -1307,6 +1310,7 @@
"https://gitlab.com/voxelands/voxelands.git",
"https://gitlab.com/wavexx/garith.git",
"https://gitlab.com/wavexx/regame.git",
"https://gitlab.com/xonotic/darkplaces.git",
"https://gitlab.com/xonotic/xonotic.git",
"https://gitlab.gnome.org/GNOME/gcompris.git",
"https://gitlab.gnome.org/GNOME/gnome-chess.git",
@ -1385,7 +1389,6 @@
"https://svn.code.sf.net/p/xswingplus/code",
"https://svn.code.sf.net/p/xu4/code",
"https://svn.code.sf.net/p/zaz/code",
"https://svn.icculus.org/twilight/trunk/darkplaces/",
"svn://raydium.org/raydium/trunk",
"svn://svn.zoy.org/abuse/abuse/trunk"
],

View File

@ -92,6 +92,7 @@ developers_index_path = developers_path + ['index.html']
games_by_language_path = games_path + ['languages.html']
games_by_genres_path = games_path + ['genres.html']
games_by_platform_path = games_path + ['platforms.html']
games_top50_path = games_path + ['top50.html']
platform_color = {
'Windows': 'is-danger',
@ -160,9 +161,11 @@ html5parser = html5lib.HTMLParser(strict=True)
def raise_helper(msg):
raise Exception(msg)
def is_list(obj):
return isinstance(obj, list)
def write(text, file):
"""
@ -318,6 +321,7 @@ def developer_index(developer):
e['tags'] = make_text('({})'.format(n), 'is-light is-size-7')
return e
def shortcut_url(url, name):
# remove slash at the end
@ -373,11 +377,46 @@ def make_url(href, content, title=None, css_class=None):
return url
def make_icon(css_class):
return {
def make_repo_url(x, name):
# parse comments
comments = []
if x.has_comment():
for c in x.comment.split(','):
c = c.strip()
if not c.startswith('@'):
continue
c = c.split(' ')
key = c[0][1:] # without the @
if len(c) > 1:
value = c[1]
if key == 'archived':
comments.append(make_text('archived', css_class='is-size-7'))
if key == 'created':
comments.append(make_text('since {}'.format(value), css_class='is-size-7'))
if key == 'stars':
value = int(value)
if value > 200:
comments.append(make_icon('star', 'top rated'))
elif value > 30:
comments.append(make_icon('star-half-full', 'medium rated'))
else:
comments.append(make_icon('star-o', 'low rated'))
# this is the default element
url = make_url(x.value, shortcut_url(x.value, name), css_class='is-size-7')
if comments:
return make_enumeration([url, make_enumeration(comments)], '')
else:
return url
def make_icon(css_class, title=None):
icon = {
'type': 'icon',
'class': css_class,
}
if title:
icon['title'] = title
return icon
def make_text(content, css_class=None):
@ -563,9 +602,11 @@ def convert_entries(entries, inspirations, developers):
divider = ', '
if not e:
continue
if isinstance(e[0], osg.osg_parse.ValueWithComment):
if isinstance(e[0], osg.osg_parse.ValueWithComment) and field != 'Code repository':
e = [x.value for x in e]
if field == 'Code language':
if field == 'Code repository':
e = [make_repo_url(x, name) for x in e]
elif field == 'Code language':
e = [make_url(code_language_references[x], make_text(x, 'is-size-7')) for x in e]
elif field == 'Code license' or field == 'Assets license':
e = [make_url(c.license_urls[x], x, css_class='is-size-7') if x in c.license_urls else make_text(x, 'is-size-7') for x in e]
@ -597,6 +638,32 @@ def add_license_links_to_entries(entries):
entry['Code license'] = licenses
def get_top50_games(games):
top50_games = []
for game in games:
# get stars of repositories
stars = 0
for repo in game.get('Code repository', []):
if repo.has_comment():
for c in repo.comment.split(','):
c = c.strip()
if not c.startswith('@'):
continue
c = c.split(' ')
key = c[0][1:] # without the @
if len(c) > 1:
value = c[1]
if key == 'stars':
value = int(value)
if value > stars:
stars = value
top50_games.append((game, stars))
top50_games.sort(key=lambda x:x[1], reverse=True)
top50_games = top50_games[:50]
top50_games =[game for game, stars in top50_games]
return top50_games
def generate(entries, inspirations, developers):
"""
@ -643,6 +710,10 @@ def generate(entries, inspirations, developers):
games_by_language = sort_into_categories(entries, c.known_languages, lambda item, category: category in item['Code language'])
frameworks_by_type = sort_into_categories(frameworks, c.framework_keywords, lambda item, category: category in item['Keyword'])
# extract top 50 Github stars games
top50_games = get_top50_games(games)
# base dictionary
base = {
'title': 'OSGL',
@ -791,6 +862,14 @@ def generate(entries, inspirations, developers):
index['category-infos'] = {}
write(template_categorical_index.render(index=index), games_by_platform_path)
# top 50 games
base['active_nav'] = ['filter', 'top50']
listing = {
'title': 'Top 50 games (stars)',
'items': top50_games
}
write(template_listing_entries.render(listing=listing), games_top50_path)
# inspirations folder
base['url_to'] = partial(url_to, inspirations_path)
base['active_nav'] = 'inspirations'

View File

@ -3,13 +3,13 @@
{%- if 'class' in text -%} {# Enhanced text #}
<span class="{{ text['class'] }}">{{ text['text'] }}</span>
{%- else -%}
<span>{{ text['text'] }}</span>
{{ text['text'] }}{# <span>{{ text['text'] }}</span> #}
{%- endif -%}
{%- endmacro -%}
{# #}
{%- macro render_icon(icon) -%}
<span class="icon has-text-black"><i class="icon-{{ icon }}"></i></span>
<span class="icon has-text-black" {% if 'title' in icon %} title="{{ icon['title'] }}"{% endif %}><i class="icon-{{ icon['class'] }}"></i></span>
{%- endmacro -%}
{# Some text surrounded by a link tag #}
@ -26,7 +26,7 @@
{%- elif entry['type'] == 'text' -%}
{{ render_text(entry) }}
{%- elif entry['type'] == 'icon' -%}
{{ render_icon(entry['class']) }}
{{ render_icon(entry) }}
{%- elif entry['type'] == 'url' -%}
{{ render_url(entry) }}
{%- elif entry['type'] == 'enumeration' -%}

View File

@ -103,10 +103,17 @@ class DevelopersMaintainer:
if not self.entries:
print('entries not yet loaded')
return
for entry in self.entries:
for developer in entry.get('Developer', []):
if developer.comment:
print('{:<25} - {:<25} - {}'.format(entry['File'], developer.value, developer.comment))
# remove all developer that are orphans
remove = [k for k, v in self.developers.items() if not v['Games']]
for k in remove:
del self.developers[k]
# # comments for developers
# for entry in self.entries:
# for developer in entry.get('Developer', []):
# if developer.comment:
# print('{:<25} - {:<25} - {}'.format(entry['File'], developer.value, developer.comment))
if __name__ == "__main__":

View File

@ -863,16 +863,16 @@ class EntriesMaintainer:
print('entries not yet loaded')
return
# which fields have lots of comments
for field in c.valid_fields:
values = [value for entry in self.entries for value in entry.get(field, [])]
if isinstance(values[0], osg_parse.ValueWithComment):
comments = [value.comment for value in values if value.comment]
# split by comma
comments = [c.strip() for comment in comments for c in comment.split(',')]
print('field {} has {} comments'.format(field, len(comments)))
for comment in set(comments):
print(' {} - {}'.format(comment, comments.count(comment)))
# # which fields have lots of comments
# for field in c.valid_fields:
# values = [value for entry in self.entries for value in entry.get(field, [])]
# if isinstance(values[0], osg_parse.ValueWithComment):
# comments = [value.comment for value in values if value.comment]
# # split by comma
# comments = [c.strip() for comment in comments for c in comment.split(',')]
# print('field {} has {} comments'.format(field, len(comments)))
# for comment in set(comments):
# print(' {} - {}'.format(comment, comments.count(comment)))
# # remove download urls that are also in home
# for entry in self.entries:
@ -884,36 +884,42 @@ class EntriesMaintainer:
# if not downloads and 'Download' in entry:
# del entry['Download']
# remove developers from all that have library as keyword
for entry in self.entries:
if 'library' in entry['Keyword']:
devs = entry.get('Developer', [])
if devs:
print('entry {} is library and has {} developer'.format(entry['File'], len(devs)))
del entry['Developer']
# # collect statistics on git repositories
# created = {}
# stars = []
# forks = []
# stats = {}
# for entry in self.entries:
# repos = entry['Code repository']
# repos = entry.get('Code repository', [])
# comments = [x.comment for x in repos if x.value.startswith('https://github.com/') and x.comment]
# for comment in comments:
# comment = comment.split(',')
# comment = [c.strip() for c in comment]
# comment = [c for c in comment if c.startswith('@')]
# if comment:
# try:
# comment = [c.split(' ') for c in comment]
# comment = [c[1] for c in comment if len(c) > 1]
# except Exception:
# print(comment)
# raise
# created[comment[0]] = created.get(comment[0], 0) + 1
# stars.append(comment[1])
# forks.append(comment[2])
# for part in comment.split(','):
# part = part.strip()
# if not part.startswith('@'):
# continue
# part = part.split(' ')
# key = part[0][1:] # without the @
# value = part[1] if len(part) > 1 else None
# stats[key] = stats.get(key, []) + [value]
# # process statistics
# stats['archived'] = len(stats['archived'])
# created = stats['created']
# stats['created'] = {}
# for year in created:
# stats['created'][year] = stats['created'].get(year, 0) + 1
#
# for key, value in sorted(created.items(), key=lambda x: x[0]):
# for key, value in sorted(stats['created'].items(), key=lambda x: x[0]):
# print("{} : {}".format(key, value))
#
# import numpy as np
# np.set_printoptions(suppress=True)
# stars = np.array(stars, dtype=np.float)
# forks = np.array(forks, dtype=np.float)
# stars = np.array(stats['stars'], dtype=np.float)
# forks = np.array(stats['forks'], dtype=np.float)
# q = np.arange(0, 1, 0.333)
# print(q)
# print(np.quantile(stars, q))

View File

@ -187,6 +187,8 @@ valid_multiplayer_modes = (
code_dependencies_aliases = {'Simple DirectMedia Layer': ('SDL', 'SDL2'), 'Simple and Fast Multimedia Library': ('SFML',),
'Boost (C++ Libraries)': ('Boost',), 'SGE Game Engine': ('SGE',), 'MegaGlest': ('MegaGlest Engine',)}
# no developers needed for libraries
# these are code dependencies that won't get their own entry, because they are not centered on gaming
general_code_dependencies_without_entry = {'OpenGL': 'https://www.opengl.org/',
'GLUT': 'https://www.opengl.org/resources/libraries/',