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

Delta Between Two Patch Sets: packagerChrome.py

Issue 29350281: Issue 4047 - Improved configuration of converted JS files (Closed)
Left Patch Set: Use defaultdict Created Aug. 30, 2016, 2:04 p.m.
Right Patch Set: Use defaultdict(list) instead lambda Created Aug. 30, 2016, 2:22 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 def createInfoModule(params): 141 def createInfoModule(params):
142 template = getTemplate('chromeInfo.js.tmpl') 142 template = getTemplate('chromeInfo.js.tmpl')
143 return template.render(params).encode('utf-8') 143 return template.render(params).encode('utf-8')
144 144
145 145
146 def convertJS(params, files): 146 def convertJS(params, files):
147 from jshydra.abp_rewrite import rewrite_js 147 from jshydra.abp_rewrite import rewrite_js
148 148
149 output_files = collections.OrderedDict() 149 output_files = collections.OrderedDict()
150 args = collections.defaultdict(lambda: []) 150 args = collections.defaultdict(list)
Vasily Kuznetsov 2016/08/30 14:13:52 This could be `collections.defaultdict(list)`.
Sebastian Noack 2016/08/30 14:23:06 Done.
151 151
152 for item in params['metadata'].items('convert_js'): 152 for item in params['metadata'].items('convert_js'):
153 filename, arg = re.search(r'^(.*?)(?:\[(.*)\])?$', item[0]).groups() 153 filename, arg = re.search(r'^(.*?)(?:\[(.*)\])?$', item[0]).groups()
154 if arg is None: 154 if arg is None:
155 output_files[filename] = (item[1].split(), item.source) 155 output_files[filename] = (item[1].split(), item.source)
156 else: 156 else:
157 args[filename].append('{}={}'.format(arg, item[1])) 157 args[filename].append('{}={}'.format(arg, item[1]))
158 158
159 for filename, (input_files, origin) in output_files.iteritems(): 159 for filename, (input_files, origin) in output_files.iteritems():
160 if '/' in filename and not files.isIncluded(filename): 160 if '/' in filename and not files.isIncluded(filename):
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmp l', 384 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmp l',
385 ('general', 'testScripts')) 385 ('general', 'testScripts'))
386 386
387 zipdata = files.zipToString() 387 zipdata = files.zipToString()
388 signature = None 388 signature = None
389 pubkey = None 389 pubkey = None
390 if keyFile != None: 390 if keyFile != None:
391 signature = signBinary(zipdata, keyFile) 391 signature = signBinary(zipdata, keyFile)
392 pubkey = getPublicKey(keyFile) 392 pubkey = getPublicKey(keyFile)
393 writePackage(outFile, pubkey, signature, zipdata) 393 writePackage(outFile, pubkey, signature, zipdata)
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld