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 base64 | 5 import base64 |
6 import hashlib | 6 import hashlib |
7 import json | 7 import json |
8 import mimetypes | 8 import mimetypes |
9 import os | 9 import os |
10 import zipfile | 10 import zipfile |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 packagerChrome.convertJS(params, files) | 162 packagerChrome.convertJS(params, files) |
163 | 163 |
164 if metadata.has_section('preprocess'): | 164 if metadata.has_section('preprocess'): |
165 files.preprocess(metadata.options('preprocess'), {'needsExt': True}) | 165 files.preprocess(metadata.options('preprocess'), {'needsExt': True}) |
166 | 166 |
167 if metadata.has_section('import_locales'): | 167 if metadata.has_section('import_locales'): |
168 packagerChrome.importGeckoLocales(params, files) | 168 packagerChrome.importGeckoLocales(params, files) |
169 | 169 |
170 files['manifest.json'] = packagerChrome.createManifest(params, files) | 170 files['manifest.json'] = packagerChrome.createManifest(params, files) |
171 | 171 |
| 172 if (metadata.has_option('general', 'backgroundScripts') and |
| 173 'lib/info.js' in metadata.get('general', 'backgroundScripts').split() an
d |
| 174 'lib/info.js' not in files): |
| 175 files['lib/info.js'] = packagerChrome.createInfoModule(params) |
| 176 |
172 move_files_to_extension(files) | 177 move_files_to_extension(files) |
173 | 178 |
174 if metadata.has_section('appx_assets'): | 179 if metadata.has_section('appx_assets'): |
175 for name, path in metadata.items('appx_assets'): | 180 for name, path in metadata.items('appx_assets'): |
176 path = os.path.join(baseDir, path) | 181 path = os.path.join(baseDir, path) |
177 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) | 182 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) |
178 | 183 |
179 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) | 184 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) |
180 files[BLOCKMAP] = create_appx_blockmap(files) | 185 files[BLOCKMAP] = create_appx_blockmap(files) |
181 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) | 186 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) |
182 | 187 |
183 files.zip(outfile, compression=zipfile.ZIP_STORED) | 188 files.zip(outfile, compression=zipfile.ZIP_STORED) |
OLD | NEW |