LEFT | RIGHT |
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 output_files = collections.OrderedDict() | 147 output_files = collections.OrderedDict() |
148 args = {} | 148 args = {} |
149 | 149 |
150 for item in params['metadata'].items('convert_js'): | 150 for item in params['metadata'].items('convert_js'): |
151 filename, arg = re.search(r'^(.*?)(?:\[(.*)\])?$', item[0]).groups() | 151 name, value = item |
| 152 filename, arg = re.search(r'^(.*?)(?:\[(.*)\])?$', name).groups() |
152 if arg is None: | 153 if arg is None: |
153 output_files[filename] = (item[1].split(), item.source) | 154 output_files[filename] = (value.split(), item.source) |
154 else: | 155 else: |
155 args.setdefault(filename, {})[arg] = item[1] | 156 args.setdefault(filename, {})[arg] = value |
156 | 157 |
157 template = getTemplate('modules.js.tmpl') | 158 template = getTemplate('modules.js.tmpl') |
158 | 159 |
159 for filename, (input_files, origin) in output_files.iteritems(): | 160 for filename, (input_files, origin) in output_files.iteritems(): |
160 if '/' in filename and not files.isIncluded(filename): | 161 if '/' in filename and not files.isIncluded(filename): |
161 continue | 162 continue |
162 | 163 |
163 current_args = args.get(filename, {}) | 164 current_args = args.get(filename, {}) |
164 current_args['autoload'] = [module for module in | 165 current_args['autoload'] = [module for module in |
165 current_args.get('autoload', '').split(',') | 166 current_args.get('autoload', '').split(',') |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmp
l', | 398 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmp
l', |
398 ('general', 'testScripts')) | 399 ('general', 'testScripts')) |
399 | 400 |
400 zipdata = files.zipToString() | 401 zipdata = files.zipToString() |
401 signature = None | 402 signature = None |
402 pubkey = None | 403 pubkey = None |
403 if keyFile != None: | 404 if keyFile != None: |
404 signature = signBinary(zipdata, keyFile) | 405 signature = signBinary(zipdata, keyFile) |
405 pubkey = getPublicKey(keyFile) | 406 pubkey = getPublicKey(keyFile) |
406 writePackage(outFile, pubkey, signature, zipdata) | 407 writePackage(outFile, pubkey, signature, zipdata) |
LEFT | RIGHT |