summaryrefslogtreecommitdiff
path: root/pylib/gyp/mac_tool.py
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@78cadc50-ecff-11dd-a971-7dbc132099af>2013-02-13 18:51:16 +0000
committerthakis@chromium.org <thakis@chromium.org@78cadc50-ecff-11dd-a971-7dbc132099af>2013-02-13 18:51:16 +0000
commit508a41bbbe7d80a0e2371f21b0bb6c484fd579aa (patch)
treefc6ad3292ac6fd6c7bfed666b9c6f28b3dee7122 /pylib/gyp/mac_tool.py
parentf59557f654455f51d47ccd1137c64d2f5e7ff0fc (diff)
downloadgyp-508a41bbbe7d80a0e2371f21b0bb6c484fd579aa.tar.gz
Fix test/mac/gyptest-app.py with Xcode 4.2.
Xcode 4.2 got stricter about strings files. Make make and ninja stricter too. BUG=chromium:175867 Review URL: https://codereview.chromium.org/12231007 git-svn-id: http://gyp.googlecode.com/svn/trunk@1573 78cadc50-ecff-11dd-a971-7dbc132099af
Diffstat (limited to 'pylib/gyp/mac_tool.py')
-rwxr-xr-xpylib/gyp/mac_tool.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/pylib/gyp/mac_tool.py b/pylib/gyp/mac_tool.py
index 69267694..c06e3beb 100755
--- a/pylib/gyp/mac_tool.py
+++ b/pylib/gyp/mac_tool.py
@@ -80,6 +80,19 @@ class MacTool(object):
def _CopyStringsFile(self, source, dest):
"""Copies a .strings file using iconv to reconvert the input into UTF-16."""
input_code = self._DetectInputEncoding(source) or "UTF-8"
+
+ # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call
+ # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints
+ # CFPropertyListCreateFromXMLData(): Old-style plist parser: missing
+ # semicolon in dictionary.
+ # on invalid files. Do the same kind of validation.
+ import CoreFoundation
+ s = open(source).read()
+ d = CoreFoundation.CFDataCreate(None, s, len(s))
+ _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None)
+ if error:
+ return
+
fp = open(dest, 'w')
args = ['/usr/bin/iconv', '--from-code', input_code, '--to-code',
'UTF-16', source]