mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-20 21:07:17 +01:00
Updated the project setup script. Now it will be able to handle old engine versions aswell.
This commit is contained in:
parent
94e965c48e
commit
a02c3f8282
88
SConstruct
88
SConstruct
@ -64,6 +64,91 @@ def setup_repository(data, clone_path, branch = 'master'):
|
|||||||
|
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
|
||||||
|
def update_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 reset', shell=True)
|
||||||
|
subprocess.call('git reset --hard', shell=True)
|
||||||
|
subprocess.call('git clean -f -d', 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()
|
||||||
|
|
||||||
|
if data[1] not in target_commits:
|
||||||
|
target_commits[data[1]] = {}
|
||||||
|
|
||||||
|
target_commits[data[1]][branch] = output
|
||||||
|
|
||||||
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
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 update_engine():
|
||||||
|
validate_repository_origin(module_config.engine_repository, './pandemonium_engine/', module_config.pandemonium_branch)
|
||||||
|
update_repository(module_config.engine_repository, '/', module_config.pandemonium_branch)
|
||||||
|
|
||||||
engine_abspath = os.path.abspath(module_config.engine_repository[1])
|
engine_abspath = os.path.abspath(module_config.engine_repository[1])
|
||||||
|
|
||||||
if not os.path.isdir(engine_abspath):
|
if not os.path.isdir(engine_abspath):
|
||||||
@ -78,6 +163,9 @@ if not os.path.isdir(engine_abspath):
|
|||||||
repository_index = 1
|
repository_index = 1
|
||||||
|
|
||||||
setup_repository(module_config.engine_repository, '/', module_config.pandemonium_branch)
|
setup_repository(module_config.engine_repository, '/', module_config.pandemonium_branch)
|
||||||
|
else:
|
||||||
|
if not os.path.isfile('pandemonium_engine/misc/scripts_app/SConstruct'):
|
||||||
|
update_engine()
|
||||||
|
|
||||||
|
|
||||||
SConscript("pandemonium_engine/misc/scripts_app/SConstruct")
|
SConscript("pandemonium_engine/misc/scripts_app/SConstruct")
|
||||||
|
Loading…
Reference in New Issue
Block a user