Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 40 lines (33 sloc) 1.234 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#!/usr/bin/python

import commands
import os
import sys
import time

try:
        del os.environ["MACOSX_DEPLOYMENT_TARGET"]
except KeyError:
        pass
from Foundation import NSMutableDictionary

if os.environ["CONFIGURATION"] == "Development":
        status, output = commands.getstatusoutput("bash -l -c 'LANGUAGE=C svn info'")
        if status != 0:
                sys.exit(status)

        for line in output.split("\n"):
                if len(line.strip()) == 0 or ":" not in line:
                        continue
                key, value = [x.lower().strip() for x in line.split(":", 1)]
                if key == "revision":
                        revision = "svn" + value
                        break
else:
        revision = time.strftime("%Y%m%d")

buildDir = os.environ["BUILT_PRODUCTS_DIR"]
infoFile = os.environ["INFOPLIST_PATH"]
path = os.path.join(buildDir, infoFile)
plist = NSMutableDictionary.dictionaryWithContentsOfFile_(path)
version = open("version.txt").read().strip() % {"extra": revision}
print "Updating versions:", infoFile, version
plist["CFBundleShortVersionString"] = version
plist["CFBundleGetInfoString"] = version
plist["CFBundleVersion"] = version
plist.writeToFile_atomically_(path, 1)

Something went wrong with that request. Please try again.