def run(self): if getDirsize(self.resPath) < getDirsize(self.newPath): print "has pack res" repalceDirName(self.resPath,self.newPath) return for item in self.walkFiles(self.resPath): newItem = item.replace(self.resPath, self.newPath,1) if os.path.exists(newItem) and os.path.getmtime(item) <= os.path.getmtime(newItem): continue newDir = os.path.dirname(newItem) extName = os.path.splitext(newItem)[1] if extName in [".DS_Store"]: continue if not os.path.exists(newDir): os.makedirs(newDir) self.copyfile(item,newItem,extName in self.blankList) if extName in self.zipList: os.system(self.pngquant + " --speed=1 --ext .png --skip-if-larger --force 256 " + newItem) print "压缩: ", newItem if extName in self.hashList: self.encodeDataAndSave(newItem) print "加密: ", newItem self.remove_unuse() repalceDirName(self.resPath,self.newPath)
def syncRes(): res = os.path.join(project_path, "res") res_new = os.path.join(project_path, "res-new") if os.path.exists(res_new): if getDirsize(res) < getDirsize(res_new): repalceDirName(res, res_new) print "change dir %s form %s" % (res, res_new) syncAI() syncEffect() syncMovieClip() syncSound() syncSoundEn() syncBackground() syncElement() syncPropSkillIcon() syncSkillIcon() syncTankIcon() syncTankHeadIcon() syncEditor() syncCocosEffect() syncPveMap() os.system('svn up %s' % res) checkSVNStatus(project_path, ["res"]) os.system('svn ci %s -m "同步资源"' % res)
def remove_unuse(self): if getDirsize(self.resPath) < getDirsize(self.newPath): return; from_list = getFileListByExt(self.resPath) to_list = getFileListByExt(self.newPath) for f in to_list: fr = f.replace(self.newPath,self.resPath,1) if not os.path.exists(fr): removeFile(f)
def updateProjects(): ppp = os.path.join(project_path,'res-new') if os.path.exists(ppp) and getDirsize(os.path.join(project_path,'res')) < getDirsize(ppp): return; print "当前res是压缩后的" rootPath = project_path pathList = ["src","res","main.js","project.json"] for r in pathList: path = os.path.join(rootPath,r) os.system("svn up %s"%path) print "update projects complete......"
def syncRes(): res = os.path.join(project_path, "res") res_new = os.path.join(project_path, "res-new") if os.path.exists(res_new): if getDirsize(res) < getDirsize(res_new): repalceDirName(res, res_new) print "change dir %s form %s" % (res, res_new) syncAI() syncEffect() syncMovieClip() syncSound() syncBackground() syncElement() syncPropSkillIcon() syncSkillIcon() syncTankIcon() syncTankHeadIcon() syncEditor() syncCocosEffect() syncPveMap()
'天天坦克/UI 效果图+输出 20170214 优化版/00 字体', 'fnt'), ('天天坦克/UI\ 效果图+输出\ 20170214\ 优化版/00\ BG', '天天坦克/UI 效果图+输出 20170214 优化版/00 BG', 'bg')] """ 语言分类资源 """ lll = [('天天坦克/UI\ 效果图+输出\ 20170214\ 优化版/00\ 英文翻译', '天天坦克/UI 效果图+输出 20170214 优化版/00 英文翻译', 'lang_en'), ('天天坦克/UI\ 效果图+输出\ 20170214\ 优化版/00\ 翻译原版', '天天坦克/UI 效果图+输出 20170214 优化版/00 翻译原版', 'lang_chs')] from myutil.utils import getDirsize import os if os.path.exists( '../res-new') and getDirsize('../res') < getDirsize('../res-new'): print "当前res是压缩后的" else: os.system('svn up %s' % toLanguage) for tu in ll: fromDir = os.path.join(fromRoot, tu[0]) toDir = os.path.join(toRoot, tu[2]) os.system("svn up %s" % fromDir) fromDir = os.path.join(fromRoot, tu[1]) syncDir(fromDir, toDir, False) checkSVNStatus(toRoot, [tu[2]]) for tu in lll: fromDir = os.path.join(fromRoot, tu[0]) toDir = os.path.join(toLanguage, "language_img", tu[2], "res",
def resBackToNormal(self): if os.path.exists(self.newPath) and getDirsize(self.resPath) < getDirsize(self.newPath): repalceDirName(self.resPath,self.newPath) print "back successfully"
] """ 语言分类资源 """ lll = [ ('天天坦克/UI\ 效果图+输出\ 20170214\ 优化版/00\ 英文翻译','天天坦克/UI 效果图+输出 20170214 优化版/00 英文翻译','lang_en'), ('天天坦克/UI\ 效果图+输出\ 20170214\ 优化版/00\ 翻译原版','天天坦克/UI 效果图+输出 20170214 优化版/00 翻译原版','lang_chs') ] from myutil.utils import getDirsize import os if os.path.exists('../res-new') and getDirsize('../res') < getDirsize('../res-new'): print "当前res是压缩后的" else: os.system('svn up %s'%toLanguage) for tu in ll: fromDir = os.path.join(fromRoot, tu[0]) toDir = os.path.join(toRoot, tu[2]) os.system("svn up %s"%fromDir) fromDir = os.path.join(fromRoot, tu[1]) syncDir(fromDir, toDir,False) checkSVNStatus(toRoot,[tu[2]]) for tu in lll: fromDir = os.path.join(fromRoot, tu[0])