在程序中获得当前app的svn版本号
- 八月 14th, 2009
- 进行评论
给app的target添加编译脚本

注意Shell:栏是/usr/bin/python
#!/usr/bin/python
from AppKit import NSMutableDictionary
import os
def increaseVersion():
# reading svn version
version = os.popen('svnversion -n').read()
version = version.split(':')[-1]
if not version[-1].isdigit():
version = version[:-1]
# reading info.plist file
projectPlist = NSMutableDictionary.dictionaryWithContentsOfFile_('Info.plist')
# setting the svn version for CFBundleShortVersionString key
projectPlist['CFBundleShortVersionString'] = version
projectPlist.writeToFile_atomically_('Info.plist', True)
if __name__ == '__main__':
increaseVersion()
