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 |
11 | 11 |
12 import packager | 12 import packager |
13 import packagerChrome | 13 import packagerChrome |
14 # These functions are unused here, but releaseAutomation.py expects them. | |
15 from packager import readMetadata, getDefaultFileName # flake8: noqa | |
16 | 14 |
17 # Files and directories expected inside of the .APPX archive. | 15 # Files and directories expected inside of the .APPX archive. |
18 MANIFEST = 'AppxManifest.xml' | 16 MANIFEST = 'AppxManifest.xml' |
19 CONTENT_TYPES = '[Content_Types].xml' | 17 CONTENT_TYPES = '[Content_Types].xml' |
20 BLOCKMAP = 'AppxBlockMap.xml' | 18 BLOCKMAP = 'AppxBlockMap.xml' |
21 EXTENSION_DIR = 'Extension' | 19 EXTENSION_DIR = 'Extension' |
22 ASSETS_DIR = 'Assets' | 20 ASSETS_DIR = 'Assets' |
23 | 21 |
24 # Size of uncompressed block in the APPX block map. | 22 # Size of uncompressed block in the APPX block map. |
25 BLOCKSIZE = 64 * 1024 | 23 BLOCKSIZE = 64 * 1024 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 if metadata.has_section('appx_assets'): | 174 if metadata.has_section('appx_assets'): |
177 for name, path in metadata.items('appx_assets'): | 175 for name, path in metadata.items('appx_assets'): |
178 path = os.path.join(baseDir, path) | 176 path = os.path.join(baseDir, path) |
179 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) | 177 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) |
180 | 178 |
181 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) | 179 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) |
182 files[BLOCKMAP] = create_appx_blockmap(files) | 180 files[BLOCKMAP] = create_appx_blockmap(files) |
183 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) | 181 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) |
184 | 182 |
185 files.zip(outfile, compression=zipfile.ZIP_STORED) | 183 files.zip(outfile, compression=zipfile.ZIP_STORED) |
LEFT | RIGHT |