Last active
August 29, 2015 14:05
-
-
Save Coneboy-k/04b222bcc6d354efe2e4 to your computer and use it in GitHub Desktop.
这是发布内部测试或者上传app store 后提取dSYM文件的py脚本。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| __author__ = 'Coneboy_k' | |
| from os import makedirs,listdir | |
| from os import path | |
| import string | |
| import time | |
| import shutil | |
| def moveFile(sourcePath,destinationPath): | |
| if path.exists(sourcePath): | |
| if path.exists(destinationPath): | |
| shutil.move(sourcePath,destinationPath) | |
| return True | |
| else: | |
| return False | |
| else : | |
| return False | |
| ############################## | |
| # 1.创建目的文件夹 | |
| # 2.拷贝dsYM文件 | |
| ############################## | |
| ############################## | |
| # Config | |
| ############################## | |
| releaseVer = raw_input('请输入版本号:') | |
| # projectName = raw_input('请输入项目名称:') | |
| projectName = 'UC_Iphone' | |
| projectdsYM = 'UC_Iphone.app.dSYM' | |
| releasePath = '/Users/sunke/Desktop/UC/1.Test_ipa/' | |
| archivePath = '/Users/sunke/Library/Developer/Xcode/Archives/' | |
| toolsPath = '/Users/sunke/Desktop/UC/1.Test_ipa/0.0TOOLS/symbolicatecrash' | |
| ############################## | |
| # 1.创建目的文件夹 | |
| ############################## | |
| finalPath = releasePath+releaseVer | |
| if not path.isdir(finalPath): | |
| makedirs(finalPath) | |
| if not path.isdir(finalPath): | |
| print '我艹你人品太差了吧' | |
| ############################## | |
| # 2.拷贝dsYM文件 | |
| ############################## | |
| dirName = time.strftime('%Y-%m-%d',time.localtime(time.time())) | |
| todayArchinvePath = archivePath+dirName | |
| archiveTimeHour = time.strftime('%H',time.localtime(time.time())) | |
| archiveTimeMin = time.strftime('%M',time.localtime(time.time())) | |
| archiveTimeHourTmp = string.atoi(archiveTimeHour) | |
| if archiveTimeHourTmp > 12: | |
| archiveTimeHourTmp = archiveTimeHourTmp-12 | |
| archiveTimeHour = '%i' % archiveTimeHourTmp | |
| if len(archiveTimeMin)>=2: | |
| archiveTimeMinTmp = string.atoi(archiveTimeMin) | |
| archiveTimeMin = '%i' % archiveTimeMinTmp | |
| # 匹配规则 | |
| # archiveTime = '%s.%s' %(archiveTimeHour,archiveTimeMin) | |
| archiveTime = '%s.' %(archiveTimeHour) | |
| # 列出目录文件并拼接出最终的结果 | |
| dirsNameAry = listdir(todayArchinvePath) | |
| for filenames in dirsNameAry: | |
| if ((projectName in filenames) and ((archiveTime in filenames))): | |
| sourcePathTmp = todayArchinvePath + '/' + filenames +'/' | |
| sourcePath = sourcePathTmp+'dSYMs/' + projectdsYM | |
| # 复制dsYM文件到指定目录 | |
| moveResult = moveFile(sourcePath,finalPath) | |
| if moveResult: | |
| shutil.copy(toolsPath,finalPath) | |
| print '%s %s 版 adHoc发布dsYM成功' %(projectName,releaseVer) | |
| else : | |
| print '%s %s 版 adHoc发布dsYM失败' %(projectName,releaseVer) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment