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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 files = packager.Files(packagerChrome.getPackageFiles(params), | 170 files = packager.Files(packagerChrome.getPackageFiles(params), |
171 packagerChrome.getIgnoredFiles(params)) | 171 packagerChrome.getIgnoredFiles(params)) |
172 | 172 |
173 if metadata.has_section('mapping'): | 173 if metadata.has_section('mapping'): |
174 mapped = metadata.items('mapping') | 174 mapped = metadata.items('mapping') |
175 files.readMappedFiles(mapped) | 175 files.readMappedFiles(mapped) |
176 files.read(baseDir, skip=[filename for filename, _ in mapped]) | 176 files.read(baseDir, skip=[filename for filename, _ in mapped]) |
177 else: | 177 else: |
178 files.read(baseDir) | 178 files.read(baseDir) |
179 | 179 |
180 if metadata.has_section('convert_js'): | 180 if metadata.has_section('bundles'): |
181 packagerChrome.convertJS(params, files) | 181 packagerChrome.create_bundles(params, files) |
182 | 182 |
183 if metadata.has_section('preprocess'): | 183 if metadata.has_section('preprocess'): |
184 files.preprocess(metadata.options('preprocess'), {'needsExt': True}) | 184 files.preprocess(metadata.options('preprocess'), {'needsExt': True}) |
185 | 185 |
186 if metadata.has_section('import_locales'): | 186 if metadata.has_section('import_locales'): |
187 packagerChrome.import_locales(params, files) | 187 packagerChrome.import_locales(params, files) |
188 | 188 |
189 files['manifest.json'] = packagerChrome.createManifest(params, files) | 189 files['manifest.json'] = packagerChrome.createManifest(params, files) |
190 | 190 |
191 if devenv: | 191 if devenv: |
192 import buildtools | 192 packagerChrome.add_devenv_requirements(files, metadata, params) |
193 import random | |
194 files.read(os.path.join(buildtools.__path__[0], | |
195 'chromeDevenvPoller__.js'), relpath='devenvPoller__.js') | |
196 files['devenvVersion__'] = str(random.random()) | |
197 | 193 |
198 move_files_to_extension(files) | 194 move_files_to_extension(files) |
199 | 195 |
200 if metadata.has_section('appx_assets'): | 196 if metadata.has_section('appx_assets'): |
201 for name, path in metadata.items('appx_assets'): | 197 for name, path in metadata.items('appx_assets'): |
202 path = os.path.join(baseDir, path) | 198 path = os.path.join(baseDir, path) |
203 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) | 199 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) |
204 | 200 |
205 files[MANIFEST] = create_appx_manifest(params, files, | 201 files[MANIFEST] = create_appx_manifest(params, files, |
206 buildNum, releaseBuild) | 202 buildNum, releaseBuild) |
207 files[BLOCKMAP] = create_appx_blockmap(files) | 203 files[BLOCKMAP] = create_appx_blockmap(files) |
208 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) | 204 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) |
209 | 205 |
210 files.zip(outfile, compression=zipfile.ZIP_STORED) | 206 files.zip(outfile, compression=zipfile.ZIP_STORED) |
LEFT | RIGHT |