#!/usr/bin/env python
import os
BASE_TAG = "SVN-Import"
BASE_VERSION = 572
# note that BASE_VERSION is for projects that were imported from SVN and want to maintain a constant
# version number history. Not the best solution, but it works (I know it is possible to pull svn
# commits into git, but this project did not)
def increaseVersion():
from AppKit import NSMutableDictionary
# result: SVN-Import-12-gb63066a
version = os.popen('git describe --match ' + BASE_TAG).read()
version = version.split('-')[-2]
# failing to cost the version to string might cause issues with Sparkle
projectPlist = NSMutableDictionary.dictionaryWithContentsOfFile_('Resources/Info.plist')
projectPlist['CFBundleVersion'] = str(int(version) + BASE_VERSION)
projectPlist.writeToFile_atomically_('Resources/Info.plist', True)
if __name__ == '__main__' and os.environ["CONFIGURATION"] != "Debug":
increaseVersion()