| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 packagerChrome.convertJS(params, files) | 164 packagerChrome.convertJS(params, files) |
| 165 | 165 |
| 166 if metadata.has_section('preprocess'): | 166 if metadata.has_section('preprocess'): |
| 167 files.preprocess(metadata.options('preprocess'), {'needsExt': True}) | 167 files.preprocess(metadata.options('preprocess'), {'needsExt': True}) |
| 168 | 168 |
| 169 if metadata.has_section('import_locales'): | 169 if metadata.has_section('import_locales'): |
| 170 packagerChrome.importGeckoLocales(params, files) | 170 packagerChrome.importGeckoLocales(params, files) |
| 171 | 171 |
| 172 files['manifest.json'] = packagerChrome.createManifest(params, files) | 172 files['manifest.json'] = packagerChrome.createManifest(params, files) |
| 173 | 173 |
| 174 if (metadata.has_option('general', 'backgroundScripts') and | 174 if devenv: |
| 175 'lib/info.js' in metadata.get('general', 'backgroundScripts').split() | 175 import buildtools |
|
kzar
2016/12/13 09:19:22
IMO this looks kind of ugly, I don't like how the
Vasily Kuznetsov
2016/12/13 18:49:58
I would have computed the background scripts list
Sebastian Noack
2016/12/15 13:58:06
I agree with Vasily here. Also, is it even necesse
Oleksandr
2016/12/22 02:53:24
I think touching packagerChrome.py would require a
| |
| 176 and 'lib/info.js' not in files): | 176 import random |
| 177 files['lib/info.js'] = packagerChrome.createInfoModule(params) | 177 files.read(os.path.join(buildtools.__path__[0], |
| 178 'chromeDevenvPoller__.js'), relpath='devenvPoller__.js') | |
| 179 files['devenvVersion__'] = str(random.random()) | |
| 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) | |
| 178 | 185 |
| 179 move_files_to_extension(files) | 186 move_files_to_extension(files) |
| 180 | 187 |
| 181 if metadata.has_section('appx_assets'): | 188 if metadata.has_section('appx_assets'): |
| 182 for name, path in metadata.items('appx_assets'): | 189 for name, path in metadata.items('appx_assets'): |
| 183 path = os.path.join(baseDir, path) | 190 path = os.path.join(baseDir, path) |
| 184 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) | 191 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) |
| 185 | 192 |
| 186 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) | 193 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) |
| 187 files[BLOCKMAP] = create_appx_blockmap(files) | 194 files[BLOCKMAP] = create_appx_blockmap(files) |
| 188 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) | 195 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) |
| 189 | 196 |
| 190 files.zip(outfile, compression=zipfile.ZIP_STORED) | 197 files.zip(outfile, compression=zipfile.ZIP_STORED) |
| LEFT | RIGHT |