From 57947e89a232e9aead1d930dcb31c5ff3f5e16ac Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Tue, 24 Mar 2020 17:29:11 +0300 Subject: [PATCH] Refactoring --- tools/linux/automate.py | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/tools/linux/automate.py b/tools/linux/automate.py index 44b53e5..05c7e12 100755 --- a/tools/linux/automate.py +++ b/tools/linux/automate.py @@ -4,6 +4,23 @@ import sys sys.path.append('../../scripts') import base import os +import subprocess + +def get_branch_name(directory): + cur_dir = os.getcwd() + os.chdir(directory) + # detect build_tools branch + popen = subprocess.Popen("git branch", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + current_branch = "master" + try: + stdout, stderr = popen.communicate() + popen.wait() + current_branch = stdout.strip() + finally: + popen.stdout.close() + popen.stderr.close() + os.chdir(cur_dir) + return current_branch def install_deps(): # dependencies @@ -101,8 +118,21 @@ if not base.is_dir("./qt_build"): print("install qt...") install_qt() -build_tools_params = ["--branch", "master", - "--module", "desktop builder server", +branch = get_branch_name("../..") +print("---------------------------------------------") +print("build branch: " + branch) +print("---------------------------------------------") + +modules = " ".join(sys.argv) +if "" == modules: + modules = "desktop builder server" + +print("---------------------------------------------") +print("build modules: " + modules) +print("---------------------------------------------") + +build_tools_params = ["--branch", branch, + "--module", modules, "--update", "1", "--qt-dir", os.getcwd() + "/qt_build"]