OLD | NEW |
1 # This Source Code Form is subject to the terms of the Mozilla Public | 1 # This Source Code Form is subject to the terms of the Mozilla Public |
2 # License, v. 2.0. If a copy of the MPL was not distributed with this | 2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
4 | 4 |
5 import errno | 5 import errno |
6 import io | 6 import io |
7 import json | 7 import json |
8 import os | 8 import os |
9 import re | 9 import re |
10 from StringIO import StringIO | 10 from StringIO import StringIO |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 # Remove access keys | 246 # Remove access keys |
247 value = sourceData[stringID] | 247 value = sourceData[stringID] |
248 match = re.search(r'^(.*?)\s*\(&.\)$', value) | 248 match = re.search(r'^(.*?)\s*\(&.\)$', value) |
249 if match: | 249 if match: |
250 value = match.group(1) | 250 value = match.group(1) |
251 else: | 251 else: |
252 index = value.find('&') | 252 index = value.find('&') |
253 if index >= 0: | 253 if index >= 0: |
254 value = value[0:index] + value[index + 1:] | 254 value = value[0:index] + value[index + 1:] |
255 data[key] = {'message': value} | 255 data[key] = {'message': value} |
256 except Exception, e: | 256 except Exception as e: |
257 print 'Warning: error importing locale data from %s: %s' % (sour
ceFile, e) | 257 print 'Warning: error importing locale data from %s: %s' % (sour
ceFile, e) |
258 | 258 |
259 files[targetFile] = toJson(data) | 259 files[targetFile] = toJson(data) |
260 | 260 |
261 | 261 |
262 def truncate(text, length_limit): | 262 def truncate(text, length_limit): |
263 if len(text) <= length_limit: | 263 if len(text) <= length_limit: |
264 return text | 264 return text |
265 return text[:length_limit - 1].rstrip() + u'\u2026' | 265 return text[:length_limit - 1].rstrip() + u'\u2026' |
266 | 266 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmp
l', | 385 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmp
l', |
386 ('general', 'testScripts')) | 386 ('general', 'testScripts')) |
387 | 387 |
388 zipdata = files.zipToString() | 388 zipdata = files.zipToString() |
389 signature = None | 389 signature = None |
390 pubkey = None | 390 pubkey = None |
391 if keyFile != None: | 391 if keyFile != None: |
392 signature = signBinary(zipdata, keyFile) | 392 signature = signBinary(zipdata, keyFile) |
393 pubkey = getPublicKey(keyFile) | 393 pubkey = getPublicKey(keyFile) |
394 writePackage(outFile, pubkey, signature, zipdata) | 394 writePackage(outFile, pubkey, signature, zipdata) |
OLD | NEW |