[tor-commits] [tor-browser-bundle/master] Port fix-info-plist from shell to Python.
gk at torproject.org
gk at torproject.org
Fri Jun 20 14:28:45 UTC 2014
commit eae09200b44e70f45a9bd267912b06bb560f238d
Author: David Fifield <david at bamsoftware.com>
Date: Thu Jun 19 01:32:11 2014 -0700
Port fix-info-plist from shell to Python.
https://trac.torproject.org/projects/tor/ticket/12400
---
gitian/build-helpers/fix-info-plist.py | 32 ++++++++++++++++++++++++++++
gitian/build-helpers/fix-info-plist.sh | 33 -----------------------------
gitian/descriptors/mac/gitian-firefox.yml | 4 ++--
3 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/gitian/build-helpers/fix-info-plist.py b/gitian/build-helpers/fix-info-plist.py
new file mode 100755
index 0000000..ccb6c68
--- /dev/null
+++ b/gitian/build-helpers/fix-info-plist.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+# Sets these keys in a property list file:
+# CFBundleGetInfoString
+# CFBundleShortVersionString
+# NSHumanReadableCopyright
+
+import getopt
+import plistlib
+import sys
+
+def usage():
+ print >> sys.stderr, "usage: %s TORBROWSER_VERSION < Info.plist > FixedInfo.plist" % sys.argv[0]
+ sys.exit(2)
+
+_, args = getopt.gnu_getopt(sys.argv[1:], "")
+
+if len(args) != 1:
+ usage()
+
+TORBROWSER_VERSION = args[0]
+
+YEAR = "2014"
+COPYRIGHT = "Tor Browser %s Copyright %s The Tor Project" % (TORBROWSER_VERSION, YEAR)
+
+plist = plistlib.readPlist(sys.stdin)
+
+plist["CFBundleGetInfoString"] = "TorBrowser %s" % TORBROWSER_VERSION
+plist["CFBundleShortVersionString"] = TORBROWSER_VERSION
+plist["NSHumanReadableCopyright"] = COPYRIGHT
+
+plistlib.writePlist(plist, sys.stdout)
diff --git a/gitian/build-helpers/fix-info-plist.sh b/gitian/build-helpers/fix-info-plist.sh
deleted file mode 100755
index 77c6af7..0000000
--- a/gitian/build-helpers/fix-info-plist.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-# We cannot use set -e in this script because read returns a non-zero value.
-export LC_ALL=C
-
-usage()
-{
- echo "usage: $0 TORBROWSER_VERSION < Info.plist > FixedInfo.plist" 1>&2
- exit 2
-}
-
-if [ $# -ne 1 ]; then
- usage;
-fi
-
-TORBROWSER_VERSION="$1"; shift
-
-# Replace version numbers.
-# Add NSHumanReadableCopyright
-
-YEAR=2014
-COPYRIGHT="Tor Browser $TORBROWSER_VERSION Copyright $YEAR The Tor Project"
-read -r -d "" SED_SCRIPT <<END
-\#<key>CFBundleGetInfoString</key>#,\#</string>\$#{
- \#</string>\$#s#>.*<#>TorBrowser $TORBROWSER_VERSION<#
-}
-\#<key>CFBundleShortVersionString</key>#,\#</string>\$#{
- \#</string>\$#s#>.*<#>$TORBROWSER_VERSION<#
- \#</string>\$#a\ <key>NSHumanReadableCopyright</key>\n <string>$COPYRIGHT</string>
-
-}
-END
-
-sed -e "$SED_SCRIPT"
diff --git a/gitian/descriptors/mac/gitian-firefox.yml b/gitian/descriptors/mac/gitian-firefox.yml
index 2616216..10077f5 100644
--- a/gitian/descriptors/mac/gitian-firefox.yml
+++ b/gitian/descriptors/mac/gitian-firefox.yml
@@ -21,7 +21,7 @@ files:
- "x86_64-apple-darwin10.tar.xz"
- "re-dzip.sh"
- "dzip.sh"
-- "fix-info-plist.sh"
+- "fix-info-plist.py"
- "versions"
script: |
INSTDIR="$HOME/install/"
@@ -73,7 +73,7 @@ script: |
# Adjust the Info.plist file
INFO_PLIST=TorBrowser.app/Contents/Info.plist
mv $INFO_PLIST tmp.plist
- ~/build/fix-info-plist.sh $TORBROWSER_VERSION < tmp.plist > $INFO_PLIST
+ ~/build/fix-info-plist.py $TORBROWSER_VERSION < tmp.plist > $INFO_PLIST
rm -f tmp.plist
~/build/re-dzip.sh TorBrowser.app/Contents/MacOS/omni.ja
~/build/re-dzip.sh TorBrowser.app/Contents/MacOS/webapprt/omni.ja
More information about the tor-commits
mailing list