improve release scripts

This commit is contained in:
lixianjing 2019-11-05 22:30:43 -08:00
parent e78df0bdd4
commit 98e75a932d
2 changed files with 23 additions and 10 deletions

View File

@ -4,9 +4,22 @@ import release_common as common
if len(sys.argv) < 2:
print("Usage: python " + sys.argv[0] + ' [exe name]')
print("Usage: python " + sys.argv[0] + ' exe [assets root] [bin root]')
print(" Ex: python " + sys.argv[0] + ' demoui.exe')
sys.exit(0)
common.init(sys.argv[1])
CWD = os.getcwd()
bin_root = CWD
assets_root = CWD
exe_name = sys.argv[1]
if len(sys.argv) > 2:
assets_root = sys.argv[2]
if len(sys.argv) > 3:
bin_root = sys.argv[3]
common.init(exe_name, assets_root, bin_root)
common.release()

View File

@ -10,27 +10,27 @@ BIN_DIR = 'bin'
EXE_NAME = 'demoui'
ASSETS_DIR = 'assets'
OUTPUT_DIR = 'release'
CWD = os.getcwd()
def init(exe):
def init(exe, assets_root, bin_root):
global BIN_DIR
global EXE_NAME
global ASSETS_DIR
global OUTPUT_DIR
EXE_NAME = exe
APP_ROOT = os.getcwd()
BIN_DIR = joinPath(APP_ROOT, 'bin')
ASSETS_DIR = joinPath(APP_ROOT, 'assets')
OUTPUT_DIR = joinPath(APP_ROOT, 'release')
BIN_DIR = joinPath(bin_root, 'bin')
OUTPUT_DIR = joinPath(CWD, 'release')
ASSETS_DIR = joinPath(assets_root, 'assets')
if not os.path.exists(BIN_DIR):
BIN_DIR = joinPath(APP_ROOT, 'build/bin')
BIN_DIR = joinPath(bin_root, 'build/bin')
if not os.path.exists(ASSETS_DIR):
ASSETS_DIR = joinPath(APP_ROOT, 'demos/assets')
ASSETS_DIR = joinPath(assets_root, 'demos/assets')
if not os.path.exists(ASSETS_DIR):
ASSETS_DIR = joinPath(APP_ROOT, '../awtk/demos/assets')
ASSETS_DIR = joinPath(assets_root, '../awtk/demos/assets')
if not os.path.exists(ASSETS_DIR):
print(ASSETS_DIR + ' not exist.')
sys.exit()