From 23212338ccee214f1f432e6b1a7a1870a8c4e70f Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 11 Jun 2022 00:39:09 +0200 Subject: [PATCH] Added the new app side script. --- misc/scripts_app/app/SConstruct | 79 +++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 misc/scripts_app/app/SConstruct diff --git a/misc/scripts_app/app/SConstruct b/misc/scripts_app/app/SConstruct new file mode 100644 index 000000000..4f3ad2302 --- /dev/null +++ b/misc/scripts_app/app/SConstruct @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2019-2021 Péter Magyar +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import os +import subprocess +import json + +import module_config + +target_commits = {} + +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) + + subprocess.call(clone_command.format(data[0][repository_index], data[1]), shell=True) + + os.chdir(full_path) + + subprocess.call('git reset', shell=True) + subprocess.call('git reset --hard', shell=True) + subprocess.call('git clean -f -d', shell=True) + subprocess.call('git checkout -B ' + branch + ' origin/' + branch, shell=True) + subprocess.call('git pull origin ' + branch, shell=True) + subprocess.call('git reset', shell=True) + subprocess.call('git reset --hard', shell=True) + + target = "" + + if data[1] in target_commits: + target = target_commits[data[1]][branch] + + subprocess.call('git checkout -B ' + branch + ' ' + target, shell=True) + subprocess.call('git clean -f -d', shell=True) + subprocess.call('git reset', shell=True) + subprocess.call('git reset --hard', shell=True) + + os.chdir(cwd) + +engine_abspath = os.path.abspath(module_config.engine_repository[1]) + +if not os.path.isdir(engine_abspath): + if not os.path.isfile('./HEADS'): + print("Error! HEADS file doesn't exists! Exiting.") + exit() + + with open('./HEADS', 'r') as infile: + target_commits = json.load(infile) + + setup_repository(module_config.engine_repository, '/', module_config.pandemonium_branch) + + +SConscript("pandemonium_engine/misc/scripts_app/SConstruct") + +