| LEFT | RIGHT | 
|---|
| (no file at all) |  | 
| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 86     params['version'] = pad_version(params['version']) | 86     params['version'] = pad_version(params['version']) | 
| 87 | 87 | 
| 88     translation = load_translation(files, defaultLocale) | 88     translation = load_translation(files, defaultLocale) | 
| 89     name_key = 'name' if release_build else 'name_devbuild' | 89     name_key = 'name' if release_build else 'name_devbuild' | 
| 90     params['display_name'] = translation[name_key]['message'] | 90     params['display_name'] = translation[name_key]['message'] | 
| 91     params['description'] = translation['description']['message'] | 91     params['description'] = translation['description']['message'] | 
| 92 | 92 | 
| 93     for size in ['44', '50', '150']: | 93     for size in ['44', '50', '150']: | 
| 94         path = '{}/logo_{}.png'.format(ASSETS_DIR, size) | 94         path = '{}/logo_{}.png'.format(ASSETS_DIR, size) | 
| 95         if path not in files: | 95         if path not in files: | 
| 96             raise KeyError(path + 'is not found in files') | 96             raise KeyError(path + ' is not found in files') | 
| 97         params['logo_' + size] = path.replace('/', '\\') | 97         params['logo_' + size] = path.replace('/', '\\') | 
| 98 | 98 | 
| 99     template = _get_template_for(MANIFEST) | 99     template = _get_template_for(MANIFEST) | 
| 100     return template.render(params).encode('utf-8') | 100     return template.render(params).encode('utf-8') | 
| 101 | 101 | 
| 102 | 102 | 
| 103 def move_files_to_extension(files): | 103 def move_files_to_extension(files): | 
| 104     """Move all files into `Extension` folder for APPX packaging.""" | 104     """Move all files into `Extension` folder for APPX packaging.""" | 
| 105     # We sort the files to ensure that 'Extension/xyz' is moved before 'xyz'. | 105     # We sort the files to ensure that 'Extension/xyz' is moved before 'xyz'. | 
| 106     # If 'xyz' is moved first, it would overwrite 'Extension/xyz' and its | 106     # If 'xyz' is moved first, it would overwrite 'Extension/xyz' and its | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 174     if metadata.has_section('appx_assets'): | 174     if metadata.has_section('appx_assets'): | 
| 175         for name, path in metadata.items('appx_assets'): | 175         for name, path in metadata.items('appx_assets'): | 
| 176             path = os.path.join(baseDir, path) | 176             path = os.path.join(baseDir, path) | 
| 177             files.read(path, '{}/{}'.format(ASSETS_DIR, name)) | 177             files.read(path, '{}/{}'.format(ASSETS_DIR, name)) | 
| 178 | 178 | 
| 179     files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) | 179     files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) | 
| 180     files[BLOCKMAP] = create_appx_blockmap(files) | 180     files[BLOCKMAP] = create_appx_blockmap(files) | 
| 181     files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) | 181     files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) | 
| 182 | 182 | 
| 183     files.zip(outfile, compression=zipfile.ZIP_STORED) | 183     files.zip(outfile, compression=zipfile.ZIP_STORED) | 
| LEFT | RIGHT | 
|---|