def ConfigXcodeProjectFile(fileProject):  
    strFile = common.GetFileString(fileProject)  

    
#  		OTHER_LDFLAGS = (
# 					"$(inherited)",
# 					"-weak_framework",
# 					CoreMotion,
# 					"-weak-lSystem",
# 				);
                # 
    strold = "\"-weak-lSystem\","
    strnew = "\"-weak-lSystem\",\n\"-ObjC\","   
    idx = strFile.find(strnew)
    if idx >= 0:
        return 

    strFile = strFile.replace(strold,strnew)

    # DEVELOPMENT_TEAM
    strold = "DEVELOPMENT_TEAM = \"\""
    strnew = "DEVELOPMENT_TEAM = \"Y9ZUK2WTEE\""   
    strFile = strFile.replace(strold,strnew)

     
    common.saveString2File(strFile,fileProject)
示例#2
0
def updateXiaoASOkeyword(jsonData, isHd):
    jsonfile = GetJsonFile(isHd)
    isOld = IsOldVersion(jsonData)
    if isOld:
        APPSTORE_KEYWORD = jsonData["APPSTORE_KEYWORD"]
        strStart = "XIAOMI_KEYWORD"
    else:
        APPSTORE_KEYWORD = jsonData["appstore"]["aso"]
        strStart = "aso_xiaomi"

    cn = APPSTORE_KEYWORD["cn"]
    en = APPSTORE_KEYWORD["en"]
    cn = cn.replace(",", " ")
    en = en.replace(",", " ")

    strEnd = "\""

    strFile = common.GetFileString(jsonfile)

    strMid = "\"cn\": \""
    strFile = replaceString2(strFile, strStart, strMid, strEnd, cn)

    strMid = "\"en\": \""
    strFile = replaceString2(strFile, strStart, strMid, strEnd, en)
    common.saveString2File(strFile, jsonfile)
示例#3
0
def replaceScreenOrientation(filePath, isHd):
    f = open(filePath, 'r')
    strFile = f.read()
    f.close()

    str = "sensorPortrait"
    if isHd:
        str = "sensorLandscape"

    strFile = strFile.replace("_SCREENORIENTATION_", str)

    common.saveString2File(strFile, filePath)
def CopyAndroidJavaFile_Weixin(rootStudio, isHD):
    dirroot = common.GetProjectConfigApp()
    strFileFrom = dirroot + "/android/src/wxapi/WXEntryActivity.java"
    strFileTo = rootStudio + "/src/main/java/com/moonma/common/share/wxapi/WXEntryActivity.java"

    # loadJson
    package = appname.GetPackage(source.ANDROID, isHD)
    # 替换包名
    f = open(strFileFrom, 'r')
    strFile = f.read()
    f.close()

    strOut = strFile.replace("_PACKAGE_", package)
    common.saveString2File(strOut, strFileTo)
def UpdateXcodeProjectFile(fileProject, isHD):
    flag = os.path.exists(fileProject)
    if not flag:
        return

    package = appname.GetPackage(source.IOS, isHD)

    # 读取xcode文件的包名
    # PRODUCT_BUNDLE_IDENTIFIER = com.moonma.xiehanzi.pad;
    strFile = common.GetFileString(fileProject)
    strHead = "PRODUCT_BUNDLE_IDENTIFIER = "
    strEnd = ";"
    idx = strFile.find(strHead)
    if idx >= 0:
        idx += len(strHead)
        strOther = strFile[idx:]
        idx = strOther.find(strEnd)
        packageold = strOther[0:idx]
        print("packageold=" + packageold)
        strFile = strFile.replace(packageold, package)
        common.saveString2File(strFile, fileProject)
def disableXmlKey(filePath, key):
    strFrom = "<" + key + ">" + "</" + key + ">"
    strTo = "<!-- <" + key + ">" + "</" + key + "> -->"
    strFile = common.GetFileString(filePath)
    strFile = strFile.replace(strFrom, strTo)
    common.saveString2File(strFile, filePath)
示例#7
0
def replacePackage(filePath, package):
    f = open(filePath, 'r')
    strFile = f.read()
    f.close()
    strFile = strFile.replace("_PACKAGE_", package)
    common.saveString2File(strFile, filePath)
示例#8
0
def replaceFile(filePath, key, value):
    f = open(filePath, 'r')
    strFile = f.read()
    f.close()
    strFile = strFile.replace(key, value)
    common.saveString2File(strFile, filePath)
示例#9
0
def replaceFileForKey(filePath, key, content):
    f = open(filePath, 'r')
    strFile = f.read()
    f.close()
    strFile = strFile.replace(key, content)
    common.saveString2File(strFile, filePath)