Commit 4bf95d6a by sikang

update script

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