new entries and reorganization of python scripts (added git archive)
This commit is contained in:
		
							
								
								
									
										14
									
								
								tools/git archive/archives.csv
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								tools/git archive/archives.csv
									
									
									
									
									
										Normal 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 | ||||
| 
 | 
							
								
								
									
										62
									
								
								tools/git archive/update.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								tools/git archive/update.py
									
									
									
									
									
										Normal 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() | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user