Esempio n. 1
0
def processAdvertising(channel, checkBox_2_isChecked, comboBox_6_currentText):
    if not checkBox_2_isChecked:
        return
    
    advertisingPath = file_operate.getAdvertisingPath()
    thirdAdvertisingName = comboBox_6_currentText
    thirdAdvertisingPath = advertisingPath + '/' + str(thirdAdvertisingName)
    print "..........", thirdAdvertisingPath
    file_operate.copyFiles(thirdAdvertisingPath + "/jar", constant.tmpPath + '/' + channel + "/jar")
    if platform.system() == 'Windows':
        dxTool = file_operate.getToolPath('dx.bat')
    else:
        dxTool = file_operate.getToolPath('dx')
#     cmd = '"%s" --dex --output="%s" "%s"' % (dxTool, file_operate.getFullPath(constant.tmpPath+'/'+channel+"/classes.dex"), file_operate.getFullPath(constant.tmpPath+'/'+channel+"/jar")) #合并jar
    cmd = '"%s" --multi-dex --dex --output="%s" "%s"' % (dxTool, file_operate.getFullPath(constant.tmpPath + '/' + channel), file_operate.getFullPath(constant.tmpPath + '/' + channel + "/jar"))  # 合并jar
    print "cmd" + cmd
    ret = file_operate.execFormatCmd(cmd)
    if ret:
        error_operate.error(104)
        return
    
    if (os.path.exists(thirdAdvertisingPath + "/advertisingScript.pyc")):
        file_operate.copyFile(thirdAdvertisingPath + "/advertisingScript.pyc", file_operate.getFullPath(constant.tmpPath + '/' + channel) + "/advertisingScript.pyc")
    
    # 合并ForManifest.xml
    manifestFile = file_operate.getFullPath(constant.tmpPath + '/' + channel + "/ForManifest.xml")
    ET.register_namespace('android', constant.androidNS)
    targetTree = ET.parse(manifestFile)
    targetRoot = targetTree.getroot()
    
    haveChanged = modifyManifest.doModifyForManifest(manifestFile, thirdAdvertisingPath + "/ForManifest.xml", targetRoot)
    if haveChanged:
        targetTree.write(manifestFile, 'UTF-8')
Esempio n. 2
0
def processMedia(channel, checkBox_voice_isChecked, comboBox_voice_currentText):
    print"----------begin processMedia--------------"
    if not checkBox_voice_isChecked:
        return
    print"----------select path--------------"
    mediaPath = file_operate.getMediaPath()
    print "path= "+comboBox_voice_currentText
    thirdMediaName = unicode(comboBox_voice_currentText)
    thirdMediaPath = mediaPath + '/' + thirdMediaName
    print "thirdMediaPath= "+thirdMediaPath
    file_operate.copyFiles(thirdMediaPath + "/jar", constant.tmpPath + '/' + channel + "/jar")
    print"----------select windows--------------"
    if platform.system() == 'Windows':
        dxTool = file_operate.getToolPath('dx.bat')
    else:
        dxTool = file_operate.getToolPath('dx')
#     cmd = '"%s" --dex --output="%s" "%s"' % (dxTool, file_operate.getFullPath(constant.tmpPath+'/'+channel+"/classes.dex"), file_operate.getFullPath(constant.tmpPath+'/'+channel+"/jar")) #合并jar
    cmd = '"%s" --multi-dex --dex --output="%s" "%s"' % (dxTool, file_operate.getFullPath(constant.tmpPath + '/' + channel), file_operate.getFullPath(constant.tmpPath + '/' + channel + "/jar"))  # 合并jar
    ret = file_operate.execFormatCmd(cmd)
    if ret:
        error_operate.error(104)
        return
    print"-----------copy libs-------------"
    # copy libs
    targetDir = file_operate.getFullPath(constant.tmpPath + '/' + channel)
    oldApkDir = targetDir + "/oldApkDir"
    if os.path.exists(thirdMediaPath + "/ForLibs"):
        if os.path.exists(oldApkDir + "/lib/armeabi") and os.path.exists(thirdMediaPath + "/ForLibs/armeabi"):
            operate.copyResToApk(thirdMediaPath + "/ForLibs/armeabi", oldApkDir + "/lib/armeabi")
        if os.path.exists(oldApkDir + "/lib/armeabi-v7a") and os.path.exists(thirdMediaPath + "/ForLibs/armeabi-v7a"):
            operate.copyResToApk(thirdMediaPath + "/ForLibs/armeabi-v7a", oldApkDir + "/lib/armeabi-v7a")
        if os.path.exists(oldApkDir + "/lib/x86") and os.path.exists(thirdMediaPath + "/ForLibs/x86"):
            operate.copyResToApk(thirdMediaPath + "/ForLibs/x86", oldApkDir + "/lib/x86")
    print"-----------copy res-------------"
     # copy res
    if os.path.exists(thirdMediaPath + "/ForRes"):
        operate.copyResToApk(thirdMediaPath + "/ForRes", oldApkDir + "/res")
        
    print"-----------copy pushScript-------------"    
    # copy pushScript
    file_operate.copyFile(thirdMediaPath + "/pushScript.pyc", targetDir + "/pushScript.pyc")
    print"----------- ForManifest-------------" 
    # 合并ForManifest.xml
    manifestFile = file_operate.getFullPath(constant.tmpPath + '/' + channel + "/ForManifest.xml")
    ET.register_namespace('android', constant.androidNS)
    targetTree = ET.parse(manifestFile)
    targetRoot = targetTree.getroot()
    print"-----------write-------------" 
    haveChanged = modifyManifest.doModifyForManifest(manifestFile, thirdMediaPath + "/ForManifest.xml", targetRoot)
    if haveChanged:
        targetTree.write(manifestFile, 'UTF-8')
    print"-----------comeplete-------------"    
Esempio n. 3
0
def processStatistics(channel, checkBox_isChecked, comboBox_4_currentText):
    if not checkBox_isChecked:
        return
    
    statisticsPath = file_operate.getStatisticsPath()
    thirdStatisticsName = comboBox_4_currentText
    thirdStatisticsPath = statisticsPath + '/' + str(thirdStatisticsName)
    print "..........", thirdStatisticsPath
    file_operate.copyFiles(thirdStatisticsPath + "/jar", constant.tmpPath + '/' + channel + "/jar")
    if platform.system() == 'Windows':
        dxTool = file_operate.getToolPath('dx.bat')
    else:
        dxTool = file_operate.getToolPath('dx')
#     cmd = '"%s" --dex --output="%s" "%s"' % (dxTool, file_operate.getFullPath(constant.tmpPath+'/'+channel+"/classes.dex"), file_operate.getFullPath(constant.tmpPath+'/'+channel+"/jar")) #合并jar
    cmd = '"%s" --multi-dex --dex --output="%s" "%s"' % (dxTool, file_operate.getFullPath(constant.tmpPath + '/' + channel), file_operate.getFullPath(constant.tmpPath + '/' + channel + "/jar"))  # 合并jar
    print "cmd" + cmd
    ret = file_operate.execFormatCmd(cmd)
    if ret:
        error_operate.error(104)
        return
    
    # copy libs
    targetDir = file_operate.getFullPath(constant.tmpPath + '/' + channel)
    oldApkDir = targetDir + "/oldApkDir"
    if os.path.exists(statisticsPath + "/ForLibs"):
        if os.path.exists(oldApkDir + "/lib/armeabi") and os.path.exists(statisticsPath + "/ForLibs/armeabi"):
            operate.copyResToApk(statisticsPath + "/ForLibs/armeabi", oldApkDir + "/lib/armeabi")
        if os.path.exists(oldApkDir + "/lib/armeabi-v7a") and os.path.exists(statisticsPath + "/ForLibs/armeabi-v7a"):
            operate.copyResToApk(statisticsPath + "/ForLibs/armeabi-v7a", oldApkDir + "/lib/armeabi-v7a")
        if os.path.exists(oldApkDir + "/lib/x86") and os.path.exists(statisticsPath + "/ForLibs/x86"):
            operate.copyResToApk(statisticsPath + "/ForLibs/x86", oldApkDir + "/lib/x86")
    
    # copy res
    if os.path.exists(statisticsPath + "/ForRes"):
        operate.copyResToApk(statisticsPath + "/ForRes", oldApkDir + "/res")
    
    if (os.path.exists(thirdStatisticsPath + "/statisticsScript.pyc")):
        file_operate.copyFile(thirdStatisticsPath + "/statisticsScript.pyc", file_operate.getFullPath(constant.tmpPath + '/' + channel) + "/statisticsScript.pyc")
    
    # 合并ForManifest.xml
    manifestFile = file_operate.getFullPath(constant.tmpPath + '/' + channel + "/ForManifest.xml")
    ET.register_namespace('android', constant.androidNS)
    targetTree = ET.parse(manifestFile)
    targetRoot = targetTree.getroot()
    
    haveChanged = modifyManifest.doModifyForManifest(manifestFile, thirdStatisticsPath + "/ForManifest.xml", targetRoot)
    if haveChanged:
        targetTree.write(manifestFile, 'UTF-8')