Commit 0018bdfd authored by Yang Wang's avatar Yang Wang

misc: exit when build script command fails

Change-Id: I70f8a48bd774978480a4f6828aa70ac932082c49
parent 5ec47bc3
......@@ -9,36 +9,31 @@ this_dir = os.path.dirname(os.path.realpath(__file__))
def execute_cmd(cmd, with_shell=False):
p = subprocess.Popen(cmd, shell=with_shell)
_, _ = p.communicate()
if p.returncode != 0:
sys.exit(1)
return p.returncode
def build_daemon(parsed_args):
make_cmd = os.path.dirname(this_dir) + '\\daemon\\compat\\msvc\\winmake.py'
os.chdir(os.path.dirname(this_dir) + '\\daemon\\compat\\msvc')
status_code = execute_cmd('python ' + make_cmd + ' -iv -t ' +
parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -b daemon')
execute_cmd('python ' + make_cmd + ' -iv -t ' +
parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -b daemon')
os.chdir(os.path.dirname(this_dir))
return status_code
def build_lrc(parsed_args):
make_cmd = os.path.dirname(this_dir) + '\\lrc\\make-lrc.py'
return execute_cmd('python ' + make_cmd + ' -gb ' + ' -t ' + parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -q ' + parsed_args.qtver)
execute_cmd('python ' + make_cmd + ' -gb ' + ' -t ' + parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -q ' + parsed_args.qtver)
def build_client(parsed_args):
os.chdir('./client-qt')
ret = 0
ret &= not execute_cmd(
'pandoc -f markdown -t html5 -o changelog.html changelog.md', True)
ret &= not execute_cmd('python make-client.py -d')
ret &= not execute_cmd('python make-client.py -b ' + '-t ' +
parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -q ' + parsed_args.qtver)
if not os.path.exists('./x64/Release/qt.conf'):
ret &= not execute_cmd(
'powershell -ExecutionPolicy Unrestricted -File copy-runtime-files.ps1' + ' "Release" ' + '"' + parsed_args.qtver + '"', True)
return ret
execute_cmd('pandoc -f markdown -t html5 -o changelog.html changelog.md', True)
execute_cmd('python make-client.py -d')
execute_cmd('python make-client.py -b ' + '-t ' +
parsed_args.toolset + ' -s ' + parsed_args.sdk + ' -q ' + parsed_args.qtver)
execute_cmd('powershell -ExecutionPolicy Unrestricted -File copy-runtime-files.ps1' + ' "Release" ' + '"' + parsed_args.qtver + '"', True)
def parse_args():
......@@ -57,20 +52,10 @@ def parse_args():
def main():
parsed_args = parse_args()
if build_daemon(parsed_args) != 0:
print('daemon build failure!')
sys.exit(1)
if build_lrc(parsed_args) != 0:
print('lrc build failure!')
sys.exit(1)
if build_client(parsed_args) != 0:
print('client build failure!')
sys.exit(1)
build_daemon(parsed_args)
build_lrc(parsed_args)
build_client(parsed_args)
if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment