opt: add build wrap in build.py

This commit is contained in:
Kingtous 2022-12-02 11:41:22 +08:00
parent 0319d1b1e5
commit 8f2d21f794

View File

@ -8,6 +8,7 @@ import urllib.request
import shutil
import hashlib
import argparse
import sys
windows = platform.platform().startswith('Windows')
osx = platform.platform().startswith(
@ -17,6 +18,14 @@ exe_path = 'target/release/' + hbb_name
flutter_win_target_dir = 'flutter/build/windows/runner/Release/'
skip_cargo = False
def custom_os_system(cmd):
err = os._system(cmd)
if err != 0:
print(f"Error occured when executing: {cmd}. Exiting.")
sys.exit(-1)
# replace prebuilt os.system
os._system = os.system
os.system = custom_os_system
def get_version():
with open("Cargo.toml", encoding="utf-8") as fh: