LEFT | RIGHT |
(no file at all) | |
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 glob | 6 import glob |
7 import io | 7 import io |
8 import json | 8 import json |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 def makeIcons(files, filenames): | 47 def makeIcons(files, filenames): |
48 icons = {} | 48 icons = {} |
49 for filename in filenames: | 49 for filename in filenames: |
50 try: | 50 try: |
51 magic, width, height = struct.unpack_from('>8s8xii', | 51 magic, width, height = struct.unpack_from('>8s8xii', |
52 files[filename]) | 52 files[filename]) |
53 except struct.error: | 53 except struct.error: |
54 magic = None | 54 magic = None |
55 if magic != '\x89PNG\r\n\x1a\n': | 55 if magic != '\x89PNG\r\n\x1a\n': |
56 raise Exception(filename + ' is no valid PNG.') | 56 raise Exception(filename + ' is no valid PNG.') |
57 if(width != height): | 57 if width != height: |
58 print >>sys.stderr, 'Warning: %s size is %ix%i, icon should be squar
e' % (filename, width, height) | 58 print >>sys.stderr, 'Warning: %s size is %ix%i, icon should be squar
e' % (filename, width, height) |
59 icons[width] = filename | 59 icons[width] = filename |
60 return icons | 60 return icons |
61 | 61 |
62 | 62 |
63 def createScriptPage(params, template_name, script_option): | 63 def createScriptPage(params, template_name, script_option): |
64 template = getTemplate(template_name, autoEscape=True) | 64 template = getTemplate(template_name, autoEscape=True) |
65 return template.render( | 65 return template.render( |
66 basename=params['metadata'].get('general', 'basename'), | 66 basename=params['metadata'].get('general', 'basename'), |
67 scripts=params['metadata'].get(*script_option).split() | 67 scripts=params['metadata'].get(*script_option).split() |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 if devenv: | 394 if devenv: |
395 add_devenv_requirements(files, metadata, params) | 395 add_devenv_requirements(files, metadata, params) |
396 | 396 |
397 zipdata = files.zipToString() | 397 zipdata = files.zipToString() |
398 signature = None | 398 signature = None |
399 pubkey = None | 399 pubkey = None |
400 if keyFile != None: | 400 if keyFile != None: |
401 signature = signBinary(zipdata, keyFile) | 401 signature = signBinary(zipdata, keyFile) |
402 pubkey = getPublicKey(keyFile) | 402 pubkey = getPublicKey(keyFile) |
403 writePackage(outFile, pubkey, signature, zipdata) | 403 writePackage(outFile, pubkey, signature, zipdata) |
LEFT | RIGHT |