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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 files['manifest.json'] = packagerChrome.createManifest(params, files) | 172 files['manifest.json'] = packagerChrome.createManifest(params, files) |
173 | 173 |
174 if devenv: | 174 if devenv: |
175 import buildtools | 175 import buildtools |
176 import random | 176 import random |
177 files.read(os.path.join(buildtools.__path__[0], | 177 files.read(os.path.join(buildtools.__path__[0], |
178 'chromeDevenvPoller__.js'), relpath='devenvPoller__.js') | 178 'chromeDevenvPoller__.js'), relpath='devenvPoller__.js') |
179 files['devenvVersion__'] = str(random.random()) | 179 files['devenvVersion__'] = str(random.random()) |
180 | 180 |
| 181 if metadata.has_option('general', 'backgroundScripts'): |
| 182 bg_scripts = metadata.get('general', 'backgroundScripts').split() |
| 183 if 'lib/info.js' in bg_scripts and 'lib/info.js' not in files: |
| 184 files['lib/info.js'] = packagerChrome.createInfoModule(params) |
| 185 |
181 move_files_to_extension(files) | 186 move_files_to_extension(files) |
182 | 187 |
183 if metadata.has_section('appx_assets'): | 188 if metadata.has_section('appx_assets'): |
184 for name, path in metadata.items('appx_assets'): | 189 for name, path in metadata.items('appx_assets'): |
185 path = os.path.join(baseDir, path) | 190 path = os.path.join(baseDir, path) |
186 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) | 191 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) |
187 | 192 |
188 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) | 193 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) |
189 files[BLOCKMAP] = create_appx_blockmap(files) | 194 files[BLOCKMAP] = create_appx_blockmap(files) |
190 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) | 195 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) |
191 | 196 |
192 files.zip(outfile, compression=zipfile.ZIP_STORED) | 197 files.zip(outfile, compression=zipfile.ZIP_STORED) |
OLD | NEW |