fix-info-plist.py 796 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python
  2. # Sets these keys in a property list file:
  3. # CFBundleGetInfoString
  4. # CFBundleShortVersionString
  5. # NSHumanReadableCopyright
  6. import getopt
  7. import plistlib
  8. import sys
  9. def usage():
  10. print >> sys.stderr, "usage: %s TORBROWSER_VERSION YEAR < Info.plist > FixedInfo.plist" % sys.argv[0]
  11. sys.exit(2)
  12. _, args = getopt.gnu_getopt(sys.argv[1:], "")
  13. if len(args) != 2:
  14. usage()
  15. TORBROWSER_VERSION = args[0]
  16. YEAR = args[1]
  17. COPYRIGHT = "Tor Browser %s Copyright %s The Tor Project" % (TORBROWSER_VERSION, YEAR)
  18. plist = plistlib.readPlist(sys.stdin)
  19. plist["CFBundleGetInfoString"] = "Tor Browser %s" % TORBROWSER_VERSION
  20. plist["CFBundleShortVersionString"] = TORBROWSER_VERSION
  21. plist["NSHumanReadableCopyright"] = COPYRIGHT
  22. plistlib.writePlist(plist, sys.stdout)