12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- # -*- coding:utf-8 -*-
- import sys, os, json, zipfile
- import merge_apk_v2,merge_apk, file_utils
- def package():
- if len(sys.argv) < 2:
- print("参数数量不正确")
- exit(1)
- config = sys.argv[1]
- if not os.path.exists(config):
- print("配置文件不存在")
- exit(1)
- apk_path = json.loads(file_utils.read_file(config))['apk_path']
- if real_apk_config(apk_path):
- print("母包接入新版SDK")
- ret = merge_apk_v2.startMerge(config)
- else:
- print("母包接入旧版SDK")
- ret = merge_apk.startMerge(config)
- if not ret:
- print("切包失败,请联系开发人员")
- exit(1)
- print("成功")
- exit(0)
- pass
- def real_apk_config(apk_path):
- if not os.path.exists(apk_path):
- return False
- z = zipfile.ZipFile(apk_path, "r")
- for filename in z.namelist():
- if filename == "assets/yyxx_game/yyxx_cfg.properties":
- return True
- return False
- if __name__ == "__main__":
- package()
|