From 9401acf5647d39d8caaa7cc3e47e0d8135920a0b Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 11 Feb 2020 17:06:06 +0100 Subject: [PATCH] The setup script will now default to the 3.2 godot branch, and can use master with adding an m parameter like `scons m`, or for updating heads `scons a=um`. --- HEADS | 2 +- SConstruct | 43 ++++++++++++++++++++++++------------------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/HEADS b/HEADS index 13bf37a3..2e33d610 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": "78074fed8dc38e74b9fe2962e8c015d1a1f9ae48", "world_generator": "09372b146936fda509f5c23a522e998d12f38e13", "entity_spell_system": "0bdf71c431b62b24d56c1fc178dbcb792e5dca3d", "ui_extensions": "38acc650db260a831dc26ca96fe9d9a087230bdc", "voxelman": "fd1ff4b4ff3cd718f4f85253f1ebc865894e5ffe", "texture_packer": "b17c174906f84de93d84aa60d010ffe603efaa28", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "entity-spell-system-addons": "d60e746b158d3ebf9d2ea306af1dd24bcae49be5", "mesh_data_resource": "4bda19b12be2c2a79a6121de6d22e48f3934e726", "ess_data": "3bd637fdd3304b64a18287a49a6b7387acf2f5de", "prop_tool": "df438053ebc900966f8f842fc65f0264f1271d49", "procedural_animations": "00f6c128bd0e9799b7f7f86e118ed68277fbe27d", "fast_quadratic_mesh_simplifier": "d3f3a829eff40a93464f6b321c13ce26d44e11e3"} \ No newline at end of file +{"engine": {"3.2": "8a0f94a688f18a9565a21657bf44791550aec96a", "master": "3e3f8a47616327d7faeb17f558bb81a943385e82"}, "world_generator": {"master": "09372b146936fda509f5c23a522e998d12f38e13"}, "entity_spell_system": {"master": "0bdf71c431b62b24d56c1fc178dbcb792e5dca3d"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "fd1ff4b4ff3cd718f4f85253f1ebc865894e5ffe"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "00f6c128bd0e9799b7f7f86e118ed68277fbe27d"}, "fast_quadratic_mesh_simplifier": {"master": "d3f3a829eff40a93464f6b321c13ce26d44e11e3"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "prop_tool": {"master": "df438053ebc900966f8f842fc65f0264f1271d49"}} \ No newline at end of file diff --git a/SConstruct b/SConstruct index 82c9e71a..af7b1b79 100644 --- a/SConstruct +++ b/SConstruct @@ -56,6 +56,8 @@ third_party_addon_repositories = [ target_commits = {} +godot_branch = '3.2' + def load_target_commits_array(): global target_commits @@ -69,7 +71,7 @@ def save_target_commits_array(): with open('./HEADS', 'w') as outfile: json.dump(target_commits, outfile) -def update_repository(data, clone_path): +def update_repository(data, clone_path, branch = 'master'): cwd = os.getcwd() full_path = cwd + clone_path + data[1] + '/' @@ -82,23 +84,29 @@ def update_repository(data, clone_path): os.chdir(full_path) subprocess.call('git reset --hard', shell=True) - subprocess.call('git pull origin master', shell=True) - subprocess.call('git checkout master', shell=True) + subprocess.call('git clean -f', shell=True) + subprocess.call('git checkout -B ' + branch + ' origin/' + branch, shell=True) subprocess.call('git reset --hard', shell=True) + subprocess.call('git clean -f', shell=True) + subprocess.call('git pull origin ' + branch, shell=True) process = subprocess.Popen('git rev-parse HEAD', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output = process.communicate()[0].decode().strip() - target_commits[data[1]] = output + + if data[1] not in target_commits: + target_commits[data[1]] = {} + + target_commits[data[1]][branch] = output os.chdir(cwd) -def setup_repository(data, clone_path): +def setup_repository(data, clone_path, branch = 'master'): cwd = os.getcwd() full_path = cwd + clone_path + data[1] + '/' if not os.path.isdir(full_path): - os.chdir(cwd + clone_path) + osnn.chdir(cwd + clone_path) subprocess.call(clone_command.format(data[0][repository_index], data[1]), shell=True) @@ -107,12 +115,10 @@ def setup_repository(data, clone_path): subprocess.call('git reset --hard', shell=True) subprocess.call('git pull origin master', shell=True) - target = 'master' - if data[1] in target_commits: - target = target_commits[data[1]] + target = target_commits[data[1]][branch] - subprocess.call('git checkout ' + target, shell=True) + subprocess.call('git checkout -B master ' + target, shell=True) subprocess.call('git reset --hard', shell=True) os.chdir(cwd) @@ -137,7 +143,7 @@ def copytree(src, dst): shutil.copy2(sp, dp) def update_engine(): - update_repository(engine_repository, '/') + update_repository(engine_repository, '/', godot_branch) def update_modules(): for rep in module_repositories: @@ -164,7 +170,7 @@ def update_all(): def setup_engine(): - setup_repository(engine_repository, '/') + setup_repository(engine_repository, '/', godot_branch) def setup_modules(): for rep in module_repositories: @@ -187,6 +193,7 @@ def setup_all(): setup_addons() setup_addons_third_party_addons() + env = Environment() if len(sys.argv) > 1: @@ -301,11 +308,6 @@ if len(sys.argv) > 1: exit() - #if arg[0] == 'r': - # pass - - - opts = Variables(args=ARGUMENTS) opts.Add('a', 'What to do', '') @@ -337,7 +339,10 @@ if not os.path.isdir('./modules'): os.mkdir('./modules') -if action == 'setup' or action == 's': +if action in 'm': + godot_branch = "master" + +if action in 'setup' or action[0] == 's': if target == 'all': setup_all() elif target == 'engine': @@ -351,7 +356,7 @@ if action == 'setup' or action == 's': setup_addons() elif target == 'third_party_addons': setup_addons_third_party_addons() -elif action == 'update' or action == 'u': +elif action in 'update' or action[0] == 'u': if target == 'all': update_all() elif target == 'engine':