Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: packagerChrome.py

Issue 29941691: Noissue - Allow imported translations to be overridden (Closed)
Patch Set: Created Nov. 9, 2018, 11:28 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 ConfigParser 5 import ConfigParser
6 import errno 6 import errno
7 import glob 7 import glob
8 import io 8 import io
9 import json 9 import json
10 import os 10 import os
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 sourceData = json.load(handle) 247 sourceData = json.load(handle)
248 248
249 # Resolve wildcard imports 249 # Resolve wildcard imports
250 if keys == '*': 250 if keys == '*':
251 importList = sourceData.keys() 251 importList = sourceData.keys()
252 importList = filter(lambda k: not k.startswith('_'), importL ist) 252 importList = filter(lambda k: not k.startswith('_'), importL ist)
253 keys = ' '.join(importList) 253 keys = ' '.join(importList)
254 254
255 for stringID in keys.split(): 255 for stringID in keys.split():
256 if stringID in sourceData: 256 if stringID in sourceData:
257 if stringID in data: 257 data.setdefault(stringID, sourceData[stringID])
258 print ('Warning: locale string {} defined multiple'
259 ' times').format(stringID)
260
261 data[stringID] = sourceData[stringID]
262 except Exception as e: 258 except Exception as e:
263 print 'Warning: error importing locale data from %s: %s' % (sour ceFile, e) 259 print 'Warning: error importing locale data from %s: %s' % (sour ceFile, e)
264 260
265 files[targetFile] = toJson(data) 261 files[targetFile] = toJson(data)
266 262
267 263
268 def truncate(text, length_limit): 264 def truncate(text, length_limit):
269 if len(text) <= length_limit: 265 if len(text) <= length_limit:
270 return text 266 return text
271 return text[:length_limit - 1].rstrip() + u'\u2026' 267 return text[:length_limit - 1].rstrip() + u'\u2026'
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if devenv: 400 if devenv:
405 add_devenv_requirements(files, metadata, params) 401 add_devenv_requirements(files, metadata, params)
406 402
407 zipdata = files.zipToString() 403 zipdata = files.zipToString()
408 signature = None 404 signature = None
409 pubkey = None 405 pubkey = None
410 if keyFile != None: 406 if keyFile != None:
411 signature = signBinary(zipdata, keyFile) 407 signature = signBinary(zipdata, keyFile)
412 pubkey = getPublicKey(keyFile) 408 pubkey = getPublicKey(keyFile)
413 writePackage(outFile, pubkey, signature, zipdata) 409 writePackage(outFile, pubkey, signature, zipdata)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld