def md5_for_onedir(directoryName, filesInDirectory): AppSysBase.instance().m_logSys.info(directoryName) for fname in filesInDirectory: fpath = os.path.join(directoryName, fname) if not os.path.isdir(fpath): #print(fname, "\t", _md5_for_file(fpath)) #updateMd5(fname, _md5_for_file(fpath)) #AppSys.AppSysBase.instance().writemd(fname, md5_for_file(fpath)) mdcallback(directoryName, fname, md5_for_file(fpath))
def onBtnClkDiff(self): #直接启动线程 if AppSysBase.instance().m_bOverVer: if AppSysBase.instance().m_verTask is None: AppSysBase.instance().m_verTask = VerTask() AppSysBase.instance().m_verTask.start() else: AppSysBase.instance().m_logSys.info('Verthread is runing')
def onBtnClkDiff(self): #直接启动线程 if AppSysBase.instance().m_bOverVer: if AppSysBase.instance().m_verTask is None: AppSysBase.instance().m_verTask = VerTask(); AppSysBase.instance().m_verTask.start() else: AppSysBase.instance().m_logSys.info('Verthread is runing')
def copyFile(srcfilename, destfilename): if os.path.isfile(srcfilename): try: shutil.copyfile(srcfilename, destfilename) AppSysBase.instance().m_logSys.info("copy file success: " + srcfilename) except: # 错误输出 AppSysBase.instance().m_logSys.info("copy file error: " + srcfilename) typeerr, value, tb = sys.exc_info() errstr = traceback.format_exception(typeerr, value, tb) AppSysBase.instance().m_logSys.info(errstr) else: AppSysBase.instance().m_logSys.info("cannot find file: " + srcfilename)
def lzmaCompress(): cmd = '"{0}" a -t7z {1} {2}'.format(AppSysBase.instance().m_config.m_z7z, AppSysBase.instance().m_pParamInfo.m_curOutCompressFullFileName, AppSysBase.instance().m_pParamInfo.m_curInCompressFullFileName) handle = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) #handle.wait() # 防止死锁 while handle.poll() != 0: try: output = handle.communicate()[0] AppSysBase.instance().m_logSys.info(output) except: exc_type, exc_value, exc_tb = sys.exc_info() output = "the exc type is: {0}, the exc value is: {1}, the exc tb is: ".format(exc_type, exc_value, exc_tb) AppSysBase.instance().m_logSys.info(output) traceback.print_exception(exc_type, exc_value, exc_tb) # 格式化输出信息 if handle.poll() != 0: # 如果不能正常结束,就结束子进程 subprocess.Popen.terminate()
def lzmaCompress(): cmd = '"{0}" a -t7z {1} {2}'.format( AppSysBase.instance().m_config.m_z7z, AppSysBase.instance().m_pParamInfo.m_curOutCompressFullFileName, AppSysBase.instance().m_pParamInfo.m_curInCompressFullFileName) handle = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) #handle.wait() # 防止死锁 while handle.poll() != 0: try: output = handle.communicate()[0] AppSysBase.instance().m_logSys.info(output) except: exc_type, exc_value, exc_tb = sys.exc_info() output = "the exc type is: {0}, the exc value is: {1}, the exc tb is: ".format( exc_type, exc_value, exc_tb) AppSysBase.instance().m_logSys.info(output) traceback.print_exception(exc_type, exc_value, exc_tb) # 格式化输出信息 if handle.poll() != 0: # 如果不能正常结束,就结束子进程 subprocess.Popen.terminate()
def lzmaUnCompress(): cmd = '"{0}" c -y {1}.7z -o *.txt'.format(AppSysBase.instance().m_config.m_z7z, AppSysBase.instance().m_pParamInfo.m_curUnCompressFullFileName) handle = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) handle.wait()
def onBtnClkCopy(self): AppSysBase.instance().m_pBuildVersion.copyFile()
def onBtnClkCheck(self): AppSysBase.instance().m_logSys.info('test button')
def md5_for_dirs(startdir): for root, dirs, files in os.walk(startdir): AppSysBase.instance().m_logSys.info(''.join(dirs)) md5_for_onedir(root, files)
def lzmaUnCompress(): cmd = '"{0}" c -y {1}.7z -o *.txt'.format( AppSysBase.instance().m_config.m_z7z, AppSysBase.instance().m_pParamInfo.m_curUnCompressFullFileName) handle = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) handle.wait()
def onBtnClkCopy(self): AppSysBase.instance().m_pBuildVersion.copyFile();
def outDiff(self): AppSysBase.instance().m_bOverVer = False # 只有在点击生成版本的时候,才更改当前版本的版本日期,设置当前版本 AppSysBase.instance().m_config.refreshVersion() AppSysBase.instance().m_config.saveCFG() # 检查目录 if not os.path.exists(AppSysBase.instance().m_config.tmpFileDir()): os.makedirs(AppSysBase.instance().m_config.tmpFileDir()) if not os.path.exists(AppSysBase.instance().m_config.outFileDir()): os.makedirs(AppSysBase.instance().m_config.outFileDir()) # 生成所有的 md5 AppSysBase.instance().m_pBuildVersion.buildFileMd() # 生成 Mini 文件 AppSysBase.instance().m_pBuildVersion.buildMiniMd() # 生成压缩文件 AppSysBase.instance().m_pBuildVersion.lzmaMd5File() # 拷贝文件 AppSysBase.instance().m_pBuildVersion.copyFileNoSafe() # 生成清单文件 AppSysBase.instance().m_pBuildVersion.buildFileListManifest() AppSysBase.instance().m_logSys.info("版本数据文件生成结束") AppSysBase.instance().m_bOverVer = True