def getUnseCodeFiles(): l = getIncludeList() ret = [] for f in l: f = f.replace("src", root) if not os.path.exists(f): ret.append(f) if len(ret) > 0: print "--------------------------------- 以下是引用了却找不以到的文件 --------------------------" print json.dumps(ret, indent=2) ret = [] for (r, _, items) in os.walk(root): if items: for f in items: if "DS_Store" in f: continue ff = os.path.join(r, f).replace(root, "src") if ff == "src/module.js" or "src/include/module" in ff: continue if not ff in l: ret.append(ff) if len(ret) > 0: dd = "../unuse-src" if not os.path.exists(dd): os.mkdir(dd) print "------------------------- 下面是没有引用到游戏内的代码 -----------------------------------------" print json.dumps(ret, indent=2) for f in ret: copyFile(f.replace("src", root), f.replace("src", dd)) removeFile(f.replace("src", root))
def syncCocosEffect(): from_dir = "/Users/tanzuoliang/Documents/projects/art/天天坦克/特效文件/cocos特效" to_dir = "%s/res/cocos_effect" % project_root # os.system("rm -rf %s"%to_dir) for f in glob.glob("%s/*/*.*" % from_dir): t_f = os.path.join(to_dir, os.path.basename(f)) copyFile(f, t_f)
def syncResFromTo(self, _from, to): baseFiels = [] for f in glob.glob(os.path.join(to, "*.*")): ext = os.path.splitext(f)[1] if ext == ".png" or ext == ".jpg": baseFiels.append(os.path.basename(f)) for f in baseFiels: left = os.path.join(_from, f) if os.path.exists(left): right = os.path.join(to, f) copyFile(left, right) else: print "err ", left
"frameworks/cocos2dx", "frameworks/cocos2d-x/cocos", "frameworks/runtime-src/Classes", "frameworks/runtime-src/proj.android/src", "frameworks/runtime-src/proj.android/jni", "frameworks/runtime-src/proj.ios_mac/ios/app", "frameworks/runtime-src/proj.ios_mac/ios/net", "frameworks/runtime-src/proj.ios_mac/ios/utils", "src/core", "src/include", "src/cube/uicore/ui/component" ] syncFiles = [ "cocosAndroid.py", "compressRes.py", "create.py", "checkImage.py", "hot_res.py", "platform.py", "publish/android/justRun.py", "frameworks/runtime-src/proj.ios_mac/ios/AppController.h", "frameworks/runtime-src/proj.ios_mac/ios/AppController.mm", "frameworks/runtime-src/proj.ios_mac/ios/RootViewController.h", "frameworks/runtime-src/proj.ios_mac/ios/RootViewController.mm", "frameworks/runtime-src/proj.ios_mac/ios/Info.plist", "main.js", "src/module.js", "src/cube/uicore/ui/NewRichText.js" ] for target in syncTarget: # print os.path.join(project,target), os.path.join(targetDir,target) copyDir(os.path.join(project, target), os.path.join(targetDir, target)) for f in syncFiles: # print os.path.join(project,f), os.path.join(targetDir,f) copyFile(os.path.join(project, f), os.path.join(targetDir, f)) os.chdir(targetDir) os.system("gitup.py")
#!/usr/bin/python from myutil.utils import copyFile import os tv_path = "../src/gameConfig/tv/gameConfig.js" tv_from = "../../branchTV/src/gameConfig/gameConfig.js" mobile_path = "../src/gameConfig/mobile/gameConfig.js" mobile_from = "../src/gameConfig/gameConfig.js" os.system("svn up %s"%tv_from) copyFile(tv_from, tv_path) os.system("svn up %s"%mobile_from) copyFile(mobile_from, mobile_path) os.system("svn ci -m '' ../src/gameConfig")
"frameworks/runtime-src/proj.android/libs/armeabi", "frameworks/runtime-src/proj.android-studio/app/ibs/armeabi" ) else: os.system( 'cocos compile -p android -m release && python publish/android/justRun.py' ) toNormalStatus() pass elif platform == 'android-studio': __decodeJS__() toPath = "frameworks/runtime-src/proj.android-studio/app/assets" if mode == '0': copyResFromproject(toPath) copySrcFromproject(toPath) elif mode == '1': copySrcFromproject(toPath) elif mode == '2': copyResFromproject(toPath) _ls = ["platform.json", "game_version.json", "project.json"] for f in _ls: copyFile(f, os.path.join(toPath, f)) toNormalStatus() pass # elif platform == 'normal': # toNormalStatus() pass else: print "the platform must be android|ios|android-studio|normal"
#!/usr/bin/python import os from myutil.utils import copyFile, addToSVN inlist = ["TestScrollver.js", "Main"] fr = "./scripts/core" project = "/Users/apple/Documents/projects/baseFrameworke" to = os.path.join(project, "scripts") for item in ["GameInit.js", "Preload.js", "core/core.d.ts"]: copyFile(os.path.join("./scripts", item), os.path.join(to, item)) to = os.path.join(to, "core") for (root, _, _items) in os.walk(fr): if _items: for item in _items: ext = os.path.splitext(item)[1] if ext == ".js" and not item in inlist: f = os.path.join(root, item) copyFile(f, f.replace(fr, to)) os.system("open %s" % project) #os.chdir(project) addToSVN(project, "test")
def hortPack2(projectroot, dirlist, staticfilelist, f, t, store): retlist = [] for d in dirlist: dd = os.path.join(projectroot, d) if not os.path.exists(dd) or not os.path.isdir(dd): print "%s is not exits or is not a dir" % dd ret = os.popen("svn diff %s -r r%s:%s --summarize" % (dd, f, t)).readlines() for l in ret: change = l[1:].strip() if os.path.exists(change): retlist.append(change) savePath = os.path.join(projectroot, store) print "savePath = %s" % savePath for fi in retlist: if not os.path.isfile(fi) or not os.path.exists(fi): continue copyFile(fi, fi.replace(projectroot, savePath)) for fi in staticfilelist: if not os.path.exists(fi): print "can not find the staticfilelist file %s" % fi continue base_name = os.path.basename(fi) copyFile(fi, os.path.join(savePath, base_name)) # game_version_path = os.path.join(store, "game_version.json") # if os.path.exists(game_version_path): # changeGameVersion(next_version, game_version_path) # else: # print "%s is not a file"%game_version_path handle_res(store) PackRes(os.path.join(savePath, "res"), os.path.join(savePath, "res-new")).run() compilejs(os.path.join(savePath, "src"), os.path.join(savePath, "jsc_src")) z = zipfile.ZipFile(savePath + ".zip", "w") for f in retlist: ff = f.replace(projectroot, savePath) tu = os.path.splitext(ff) if tu[1] == ".js": ff = tu[0] + ".jsc" if not os.path.exists(ff): continue z.write(ff, ff.replace(savePath, "")) print "write %s to zip" % ff for f in staticfilelist: if not os.path.exists(f): continue base_name = os.path.basename(f) z.write(os.path.join(savePath, base_name), base_name) print "write %s to zip" % os.path.join(savePath, base_name) handleMainjs() copyFile("mainjs/main.jsc", os.path.join(savePath, "main.jsc")) z.write(os.path.join(savePath, "main.jsc"), "main.jsc")
def linkFile(self, _from, to): copyFile(_from, _to)
def syncSignalCocosEffect(from_dir, to_dir): for f in glob.glob("%s/*/*.*" % from_dir): t_f = os.path.join(to_dir, os.path.basename(f)) copyFile(f, t_f)
def copyFromTVToMobile(): for f in copylist: FromFile = os.path.join(To, f) ToFile = os.path.join(From, f) copyFile(FromFile, ToFile) os.system("svn ci -m '' %s" % To)
#!/usr/bin/python from myutil.utils import copyDir, copyFile import os print os.getcwd() """ cubeWar-ahteuyawqnksliahfvgarrnmskun """ frRoot = "../" toRoot = "/Users/tianyi/Library/Developer/Xcode/DerivedData/cubeWar-ahteuyawqnksliahfvgarrnmskun/Build/Products/Debug/cubeWar-desktop copy.app/Contents/Resources" copyDir(os.path.join(frRoot, "src"), os.path.join(toRoot, "src")) copyDir(os.path.join(frRoot, "res"), os.path.join(toRoot, "res")) copyFile(os.path.join(frRoot, "main.js"), os.path.join(toRoot, "main.js")) copyFile(os.path.join(frRoot, "platform.json"), os.path.join(toRoot, "platform.json")) copyDir( os.path.join(frRoot, "frameworks/cocos2d-x/cocos/scripting/js-bindings/script"), os.path.join(toRoot, "script")) os.system( "open -n /Users/tianyi/Library/Developer/Xcode/DerivedData/cubeWar-ahteuyawqnksliahfvgarrnmskun/Build/Products/Debug/cubeWar-desktop\ copy.app" )
def syncFiles(fromDir, toDir, fl): for f in fl: copyFile(os.path.join(fromDir, f), os.path.join(toDir, f))