We Recommend

Learning Python Learning Python
The authors of Learning Python show you enough essentials of the Python scripting language to enable you to begin solving problems right away, then reveal more powerful aspects of the language one at a time. This approach is sure to appeal to programmers and system administrators who have urgent problems and a preference for learning by semi-guided experimentation.


Posted By

sudarkoff on 09/11/08


Tagged

python xcode git


Versions (?)


Git and XCode: A git build number script


Published in: Python 


URL: http://www.cimgf.com/2008/04/13/git-and-xcode-a-git-build-number-script/

The script was modified slightly based on comments.

  1. import os
  2. from Foundation import NSMutableDictionary
  3.  
  4. version = os.popen4("git rev-parse --short HEAD")[1].read()
  5. info = os.environ['INFOPLIST_PATH']
  6.  
  7. plist = NSMutableDictionary.dictionaryWithContentsOfFile_(info)
  8. plist['CFBundleVersion'] = version
  9. plist.writeToFile_atomically_(info, 1)

Report this snippet 

You need to login to post a comment.