Switched to my own godot fork temporarily. I'm hoping that eventually I'll be able to switch to godot 4.x. (I expect this to still take quite a while.) However until then I'm planning to just grab all the useful prs/features and either merge or backport them, as development for the 3.x branch has slowed down considerably (and understandably). Also I need features more for the project than compatibility so this way I can just change anything when needed.

This commit is contained in:
Relintai 2021-09-21 20:21:06 +02:00
parent 1ec78bd663
commit 85bec5de68
2 changed files with 52 additions and 1 deletions

View File

@ -174,6 +174,55 @@ def copytree(src, dst):
shutil.copy2(sp, dp) shutil.copy2(sp, dp)
def validate_repository_origin(data, clone_path, branch = 'master'):
full_path = os.path.abspath(clone_path)
if not os.path.isdir(full_path):
return
cwd = os.getcwd()
os.chdir(full_path)
res = subprocess.run('git remote -v', shell=True, capture_output=True)
resstr = res.stdout.decode('ascii')
resarr = resstr.split("\n")
res_orig = []
for l in resarr:
if "origin" in l:
res_orig.append(l)
if len(res_orig) == 0:
print("The repository " + clone_path + " does not seem to have an origin remote. Adding it.")
subprocess.call('git remote add origin ' + data[0][repository_index], shell=True)
os.chdir(cwd)
return
for l in data[0]:
for ll in res_orig:
if l in ll:
os.chdir(cwd)
return
rind = 0
if 'git@' in res_orig[0]:
rind = 1
subprocess.call('git remote remove origin', shell=True)
subprocess.call('git remote add origin ' + data[0][rind], shell=True)
subprocess.call('git pull origin', shell=True)
subprocess.call('git checkout origin/' + branch, shell=True)
print('Updated git remote origin in ' + clone_path)
os.chdir(cwd)
def remove_repository(data, target_folder): def remove_repository(data, target_folder):
folder = os.path.abspath(target_folder + data[1]) folder = os.path.abspath(target_folder + data[1])
@ -181,6 +230,7 @@ def remove_repository(data, target_folder):
shutil.rmtree(folder) shutil.rmtree(folder)
def update_engine(): def update_engine():
validate_repository_origin(module_config.engine_repository, './engine/', module_config.godot_branch)
update_repository(module_config.engine_repository, '/', module_config.godot_branch) update_repository(module_config.engine_repository, '/', module_config.godot_branch)
def update_modules(): def update_modules():
@ -208,6 +258,7 @@ def update_all():
def setup_engine(): def setup_engine():
validate_repository_origin(module_config.engine_repository, './engine/', module_config.godot_branch)
setup_repository(module_config.engine_repository, '/', module_config.godot_branch) setup_repository(module_config.engine_repository, '/', module_config.godot_branch)
def setup_modules(): def setup_modules():

View File

@ -1,7 +1,7 @@
godot_branch = '3.x' godot_branch = '3.x'
engine_repository = [ ['https://github.com/godotengine/godot.git', 'git@github.com:godotengine/godot.git'], 'engine', '' ] engine_repository = [ ['https://github.com/Relintai/godot.git', 'git@github.com:Relintai/godot.git'], 'engine', '' ]
module_repositories = [ module_repositories = [
[ ['https://github.com/Relintai/world_generator.git', 'git@github.com:Relintai/world_generator.git'], 'world_generator', '' ], [ ['https://github.com/Relintai/world_generator.git', 'git@github.com:Relintai/world_generator.git'], 'world_generator', '' ],