new entries and reorganization of python scripts (added git archive)

This commit is contained in:
Trilarion
2018-06-01 09:23:02 +02:00
parent ce9c189ce1
commit 22d7ec4537
18 changed files with 246 additions and 23 deletions

View File

@ -0,0 +1,14 @@
https://github.com/guillaume-gouchon/island
https://github.com/FreezingMoon/AncientBeast
https://github.com/godrin/antargis
https://github.com/bote-team/bote
https://github.com/Trilarion/civil
https://github.com/SWY1985/CivOne
https://github.com/colobot/colobot
https://github.com/tautvilas/epoh
https://github.com/hinogi/eternalwinterwars
https://github.com/infidel-/cult
https://github.com/Vakarias/farcolony
https://github.com/freeciv/freeciv
https://github.com/freeciv/freeciv-web
https://github.com/freeorion/freeorion
1 https://github.com/guillaume-gouchon/island
2 https://github.com/FreezingMoon/AncientBeast
3 https://github.com/godrin/antargis
4 https://github.com/bote-team/bote
5 https://github.com/Trilarion/civil
6 https://github.com/SWY1985/CivOne
7 https://github.com/colobot/colobot
8 https://github.com/tautvilas/epoh
9 https://github.com/hinogi/eternalwinterwars
10 https://github.com/infidel-/cult
11 https://github.com/Vakarias/farcolony
12 https://github.com/freeciv/freeciv
13 https://github.com/freeciv/freeciv-web
14 https://github.com/freeorion/freeorion

View File

@ -0,0 +1,62 @@
"""
Clones and/or pulls all the gits listed in archives.csv
Requires: git executable in the path
Warning: This may take a long time on the first run and may need a lot of storage space!
"""
import os
import csv
import subprocess
def derive_folder_name(url):
github = 'https://github.com/'
if url.startswith(github):
url = url[len(github):].split('/')
folder = 'github.' + url[0] + '.' + url[1] + '.git'
return folder
def clone(url, folder):
result = subprocess.run(["git", "clone", url, folder])
if result.returncode:
print(result)
def pull():
result = subprocess.run(["git", "pull", "--all"])
if result.returncode:
print(result)
if __name__ == '__main__':
# get this folder
root_folder = os.path.realpath(os.path.dirname(__file__))
# read archives.csv
archives = []
with open('archives.csv', newline='') as f:
reader = csv.reader(f)
for row in reader:
archives.append(row)
# loop over archives
for archive in archives:
url = archive[0]
folder = os.path.join(root_folder, derive_folder_name(url))
# if not existing do the initial checkout
if not os.path.isdir(folder):
os.chdir(root_folder)
clone(url, folder)
# pull all
os.chdir(folder)
pull()