OLD | NEW |
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 # ... = icon-19.png icon-38.png popup.html | 94 # ... = icon-19.png icon-38.png popup.html |
95 popup = icons.pop() | 95 popup = icons.pop() |
96 icon = makeIcons(files, icons) | 96 icon = makeIcons(files, icons) |
97 else: | 97 else: |
98 # ... = icon-16.png icon-32.png icon-48.png | 98 # ... = icon-16.png icon-32.png icon-48.png |
99 icon = makeIcons(files, icons) | 99 icon = makeIcons(files, icons) |
100 popup = None | 100 popup = None |
101 | 101 |
102 templateData[opt] = {'icon': icon, 'popup': popup} | 102 templateData[opt] = {'icon': icon, 'popup': popup} |
103 | 103 |
| 104 # Generate templatedataa which does not need special processing |
| 105 templateData.update({'extra': metadata.as_json_object('manifest')}) |
| 106 |
104 if metadata.has_option('general', 'icons'): | 107 if metadata.has_option('general', 'icons'): |
105 templateData['icons'] = makeIcons(files, | 108 templateData['icons'] = makeIcons(files, |
106 metadata.get('general', 'icons').split
()) | 109 metadata.get('general', 'icons').split
()) |
107 | 110 |
108 if metadata.has_option('general', 'permissions'): | |
109 templateData['permissions'] = metadata.get('general', 'permissions').spl
it() | |
110 | |
111 if metadata.has_option('general', 'optionalPermissions'): | |
112 templateData['optionalPermissions'] = metadata.get( | |
113 'general', 'optionalPermissions').split() | |
114 | |
115 if metadata.has_option('general', 'backgroundScripts'): | 111 if metadata.has_option('general', 'backgroundScripts'): |
116 templateData['backgroundScripts'] = metadata.get( | 112 templateData['backgroundScripts'] = metadata.get( |
117 'general', 'backgroundScripts').split() | 113 'general', 'backgroundScripts').split() |
118 if params['devenv']: | 114 if params['devenv']: |
119 templateData['backgroundScripts'].append('devenvPoller__.js') | 115 templateData['backgroundScripts'].append('devenvPoller__.js') |
120 | 116 |
121 if metadata.has_option('general', 'webAccessible') and metadata.get('general
', 'webAccessible') != '': | |
122 templateData['webAccessible'] = metadata.get('general', | |
123 'webAccessible').split() | |
124 | |
125 if metadata.has_section('contentScripts'): | 117 if metadata.has_section('contentScripts'): |
126 contentScripts = [] | 118 contentScripts = [] |
127 for run_at, scripts in metadata.items('contentScripts'): | 119 for run_at, scripts in metadata.items('contentScripts'): |
128 if scripts == '': | 120 if scripts == '': |
129 continue | 121 continue |
130 contentScripts.append({ | 122 contentScripts.append({ |
131 'matches': ['http://*/*', 'https://*/*'], | 123 'matches': ['http://*/*', 'https://*/*'], |
132 'js': scripts.split(), | 124 'js': scripts.split(), |
133 'run_at': run_at, | 125 'run_at': run_at, |
134 'all_frames': True, | 126 'all_frames': True, |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 if devenv: | 388 if devenv: |
397 add_devenv_requirements(files, metadata, params) | 389 add_devenv_requirements(files, metadata, params) |
398 | 390 |
399 zipdata = files.zipToString() | 391 zipdata = files.zipToString() |
400 signature = None | 392 signature = None |
401 pubkey = None | 393 pubkey = None |
402 if keyFile != None: | 394 if keyFile != None: |
403 signature = signBinary(zipdata, keyFile) | 395 signature = signBinary(zipdata, keyFile) |
404 pubkey = getPublicKey(keyFile) | 396 pubkey = getPublicKey(keyFile) |
405 writePackage(outFile, pubkey, signature, zipdata) | 397 writePackage(outFile, pubkey, signature, zipdata) |
OLD | NEW |