| LEFT | RIGHT |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This Source Code Form is subject to the terms of the Mozilla Public | 3 # This Source Code Form is subject to the terms of the Mozilla Public |
| 4 # License, v. 2.0. If a copy of the MPL was not distributed with this | 4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 6 | 6 |
| 7 import sys | 7 import sys |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import json | 10 import json |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 for filename in filenames: | 53 for filename in filenames: |
| 54 width, height = Image.open(StringIO(files[filename])).size | 54 width, height = Image.open(StringIO(files[filename])).size |
| 55 if(width != height): | 55 if(width != height): |
| 56 print >>sys.stderr, 'Warning: %s size is %ix%i, icon should be square' % (
filename, width, height) | 56 print >>sys.stderr, 'Warning: %s size is %ix%i, icon should be square' % (
filename, width, height) |
| 57 icons[width] = filename | 57 icons[width] = filename |
| 58 return icons | 58 return icons |
| 59 | 59 |
| 60 def createScriptPage(params, template_name, script_option): | 60 def createScriptPage(params, template_name, script_option): |
| 61 template = getTemplate(template_name, autoEscape=True) | 61 template = getTemplate(template_name, autoEscape=True) |
| 62 return template.render( | 62 return template.render( |
| 63 basename=params['metadata'].get('general', 'basename'), |
| 63 scripts=params['metadata'].get(*script_option).split() | 64 scripts=params['metadata'].get(*script_option).split() |
| 64 ).encode('utf-8') | 65 ).encode('utf-8') |
| 65 | 66 |
| 66 def createManifest(params, files): | 67 def createManifest(params, files): |
| 67 template = getTemplate('manifest.json.tmpl') | 68 template = getTemplate('manifest.json.tmpl') |
| 68 templateData = dict(params) | 69 templateData = dict(params) |
| 69 | 70 |
| 70 baseDir = templateData['baseDir'] | 71 baseDir = templateData['baseDir'] |
| 71 metadata = templateData['metadata'] | 72 metadata = templateData['metadata'] |
| 72 | 73 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmpl', | 368 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmpl', |
| 368 ('general', 'testScripts')) | 369 ('general', 'testScripts')) |
| 369 | 370 |
| 370 zipdata = files.zipToString() | 371 zipdata = files.zipToString() |
| 371 signature = None | 372 signature = None |
| 372 pubkey = None | 373 pubkey = None |
| 373 if keyFile != None: | 374 if keyFile != None: |
| 374 signature = signBinary(zipdata, keyFile) | 375 signature = signBinary(zipdata, keyFile) |
| 375 pubkey = getPublicKey(keyFile) | 376 pubkey = getPublicKey(keyFile) |
| 376 writePackage(outFile, pubkey, signature, zipdata) | 377 writePackage(outFile, pubkey, signature, zipdata) |
| LEFT | RIGHT |