Commit 4bf95d6a by sikang

update script

parent 76e36b7d
# -*-coding:utf-8-*-
from utils import Utils
from tools.screen_maker import ScreenMaker
import random
import sys
......@@ -15,8 +14,8 @@ import chardet
class Function:
# 随机生成包名
@staticmethod
def new_appid(app_name):
app_name = app_name.replace(" ", "").lower()
def new_appid(config):
app_name = config['app_name'].replace(" ", "").lower()
start_name = ["com", "cn", "id", "app", "host", "in"]
middle_name = ["android", "main", "home", "base", "play", "release", "full", "kredit", "cepat",
"saku", "wallet", "coin", "loan", "flash", "pjnm", "indo", "lib"]
......@@ -32,7 +31,16 @@ class Function:
random_str = ''.join(random.sample(
"abcdefghijklmnopqrstuvwxyz", random.randint(4, 8)))
pkg_name += "." + random_str
return pkg_name
version_code = str(int(config['version_code'])+1)
version_name = "#%s#"% version_code.replace("",".")
version_name = version_name.replace("#.","").replace(".#","")
lines = {
"app_id": pkg_name,
"version_code": version_code,
"version_name": version_name
}
Function.update_properties(config,lines)
# 加载shell变量
@staticmethod
......@@ -43,8 +51,8 @@ class Function:
config = {}
for line in lines:
if "=" in line:
key = Utils.clearStr(line.split("=")[0], ["\"", "\'", "\n"])
value = Utils.clearStr(line.split("=")[1], ["\"", "\'", "\n"])
key = line.split("=")[0].replace("\"","").replace("\'","").replace("\n","")
value = line.split("=")[1].replace("\"","").replace("\'","").replace("\n","")
config[key] = value
return config
......
......@@ -36,8 +36,8 @@ if command == 1:
Shell.build_release()
elif command == 2:
app_name = Function.new_appid(config['app_name'])
print(app_name)
Function.new_appid(config)
elif command == 3:
Function.new_keystore(config)
......
# -*-coding:utf-8-*-
import string
import os
class Utils:
@staticmethod
def clearStr(value,targets):
for target in targets:
value = value.replace(target,"")
return value
\ No newline at end of file
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