imported some svn repositories to git, improved html
This commit is contained in:
@ -3,6 +3,14 @@
|
||||
"http://repo.or.cz/openal-soft.git",
|
||||
"https://anongit.freedesktop.org/git/pkg-config.git",
|
||||
"https://anongit.kde.org/katomic.git",
|
||||
"https://git.code.sf.net/p/arianne/marauroa",
|
||||
"https://git.code.sf.net/p/autorealm/code",
|
||||
"https://git.code.sf.net/p/autorealm/delphi",
|
||||
"https://git.code.sf.net/p/autorealm/http",
|
||||
"https://git.code.sf.net/p/battlefieldjava/git",
|
||||
"https://git.code.sf.net/p/dangerdeep/git",
|
||||
"https://git.code.sf.net/p/dropshock/code",
|
||||
"https://git.code.sf.net/p/rmoffice/code",
|
||||
"https://git.octaforge.org/engine/octaforge.git",
|
||||
"https://git.savannah.gnu.org/git/adonthell/adonthell-wastesedge.git",
|
||||
"https://git.savannah.gnu.org/git/freedink.git",
|
||||
@ -12,6 +20,7 @@
|
||||
"https://git.savannah.nongnu.org/git/lordsawar.git",
|
||||
"https://git.tukaani.org/xz.git",
|
||||
"https://git.tuxfamily.org/fanwor/fanwor.git",
|
||||
"https://github.com/0ad/0ad.git",
|
||||
"https://github.com/AdamAtomic/flixel.git",
|
||||
"https://github.com/Ancurio/mkxp.git",
|
||||
"https://github.com/AndO3131/lgeneral.git",
|
||||
@ -65,6 +74,10 @@
|
||||
"https://github.com/Scorched-Moon/server.git",
|
||||
"https://github.com/TVTower/TVTower.git",
|
||||
"https://github.com/TobiasBielefeld/Simple-Solitaire.git",
|
||||
"https://github.com/Trilarion/deity.git",
|
||||
"https://github.com/Trilarion/dungeonmap.git",
|
||||
"https://github.com/Trilarion/freetrain.git",
|
||||
"https://github.com/Trilarion/rpdungeon.git",
|
||||
"https://github.com/Trilarion/sge2d.git",
|
||||
"https://github.com/Tuxemon/Tuxemon.git",
|
||||
"https://github.com/Vakarias/farcolony.git",
|
||||
|
@ -6,12 +6,13 @@
|
||||
Warning: This may take a long time on the first run and may need a lot of storage space!
|
||||
|
||||
TODO are really all existing branches cloned and pulled? (see https://stackoverflow.com/questions/67699/how-to-clone-all-remote-branches-in-git)
|
||||
TODO detect unused folders?
|
||||
TODO Sourceforge git clone may not work all the time (restart the script helps..)
|
||||
"""
|
||||
|
||||
import os
|
||||
import json
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
|
||||
def read_text(file):
|
||||
@ -22,6 +23,7 @@ def read_text(file):
|
||||
text = f.read()
|
||||
return text
|
||||
|
||||
|
||||
def derive_folder_name(url):
|
||||
replaces = {
|
||||
'https://github.com': 'github',
|
||||
@ -42,6 +44,7 @@ def derive_folder_name(url):
|
||||
url = url[len(generic):]
|
||||
return sanitize(url)
|
||||
|
||||
|
||||
def clone(url, folder):
|
||||
result = subprocess.run(["git", "clone", url, folder])
|
||||
if result.returncode:
|
||||
@ -84,12 +87,14 @@ if __name__ == '__main__':
|
||||
for folder, archive in zip(folders, archives):
|
||||
if not os.path.isdir(folder):
|
||||
clone(archive, folder)
|
||||
time.sleep(0.1) # not sure if this is necessary, but there were some issues with too many git operations
|
||||
|
||||
# at the end update them all
|
||||
for folder in folders:
|
||||
# pull all
|
||||
os.chdir(folder)
|
||||
pull()
|
||||
time.sleep(0.1) # not sure if this is necessary, but there were some issues with too many git operations
|
||||
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@ import urllib.request
|
||||
import http.client
|
||||
import datetime
|
||||
import json
|
||||
import textwrap
|
||||
|
||||
TOC = '_toc.md'
|
||||
|
||||
@ -276,8 +277,16 @@ def parse_entry(content):
|
||||
regex = re.compile(r"^# (.*)")
|
||||
matches = regex.findall(content)
|
||||
assert len(matches) == 1
|
||||
assert matches[0]
|
||||
info['title'] = matches[0]
|
||||
|
||||
# read description
|
||||
regex = re.compile(r"^.*\n\n_(.*)_\n")
|
||||
matches = regex.findall(content)
|
||||
assert len(matches) == 1, info['title']
|
||||
assert matches[0]
|
||||
info['description'] = matches[0]
|
||||
|
||||
# first read all field names
|
||||
regex = re.compile(r"^- (.*?): ", re.MULTILINE)
|
||||
fields = regex.findall(content)
|
||||
@ -498,7 +507,7 @@ def export_json():
|
||||
|
||||
# make database out of it
|
||||
db = {}
|
||||
db['headings'] = ['Game', 'Description', 'Download', 'State', 'Keywords', 'Source']
|
||||
db['headings'] = ['Game', 'Description', 'Download', 'Category', 'State', 'Keywords', 'Source']
|
||||
|
||||
entries = []
|
||||
for info in infos.values():
|
||||
@ -509,7 +518,7 @@ def export_json():
|
||||
entry.append('{} (<a href="{}">home</a>, <a href="{}">entry</a>)'.format(info['title'], info['home'][0], ''))
|
||||
|
||||
# description
|
||||
entry.append('')
|
||||
entry.append(textwrap.shorten(info['description'], width=80, placeholder='..'))
|
||||
|
||||
# download
|
||||
field = 'download'
|
||||
@ -518,6 +527,9 @@ def export_json():
|
||||
else:
|
||||
entry.append('')
|
||||
|
||||
# category
|
||||
entry.append(info['category'])
|
||||
|
||||
# state (field state is essential)
|
||||
entry.append('{} / {}'.format(info['state'][0], 'inactive since {}'.format(info['inactive']) if 'inactive' in info else 'active'))
|
||||
|
||||
@ -529,8 +541,17 @@ def export_json():
|
||||
entry.append('')
|
||||
|
||||
# source
|
||||
text = ''
|
||||
entry.append(text)
|
||||
text = []
|
||||
field = 'code repository'
|
||||
if field in info and info[field]:
|
||||
text.append('<a href="{}">Source</a>'.format(info[field][0]))
|
||||
field = 'code language'
|
||||
if field in info and info[field]:
|
||||
text.append(', '.join(info[field]))
|
||||
field = 'code license'
|
||||
if field in info and info[field]:
|
||||
text.append(info[field][0])
|
||||
entry.append(' - '.join(text))
|
||||
|
||||
# append to entries
|
||||
entries.append(entry)
|
||||
@ -558,9 +579,7 @@ def git_repo(repo):
|
||||
return repo + '.git'
|
||||
|
||||
# for all others we just check if they start with the typical urls of git services
|
||||
|
||||
# 'https://git.code.sf.net/p/' currently doesn't work that well
|
||||
services = ['https://git.tuxfamily.org/', 'http://git.pond.sub.org/', 'https://gitorious.org/']
|
||||
services = ['https://git.tuxfamily.org/', 'http://git.pond.sub.org/', 'https://gitorious.org/', 'https://git.code.sf.net/p/']
|
||||
for service in services:
|
||||
if repo.startswith(service):
|
||||
return repo
|
||||
|
Reference in New Issue
Block a user