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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 groups = (version.split('.') + ['0', '0', '0'])[:4] | 75 groups = (version.split('.') + ['0', '0', '0'])[:4] |
76 return '.'.join(groups) | 76 return '.'.join(groups) |
77 | 77 |
78 | 78 |
79 def create_appx_manifest(params, files, release_build=False): | 79 def create_appx_manifest(params, files, release_build=False): |
80 """Create AppxManifest.xml.""" | 80 """Create AppxManifest.xml.""" |
81 params = dict(params) | 81 params = dict(params) |
82 metadata = params['metadata'] | 82 metadata = params['metadata'] |
83 w = params['windows_version'] = {} | 83 w = params['windows_version'] = {} |
84 w['min'], w['max'] = metadata.get('compat', 'windows').split('/') | 84 w['min'], w['max'] = metadata.get('compat', 'windows').split('/') |
85 params.update(metadata.items('general')) | |
86 params['version'] = pad_version(params['version']) | 85 params['version'] = pad_version(params['version']) |
87 | 86 |
88 metadata_suffix = 'release' if release_build else 'devbuild' | 87 metadata_suffix = 'release' if release_build else 'devbuild' |
89 app_extension_id = 'extension_id_' + metadata_suffix | 88 app_extension_id = 'extension_id_' + metadata_suffix |
90 if metadata.has_option('general', app_extension_id): | 89 if metadata.has_option('general', app_extension_id): |
91 params['app_extension_id'] = metadata.get('general', app_extension_id) | 90 params['app_extension_id'] = metadata.get('general', app_extension_id) |
92 else: | 91 else: |
93 params['app_extension_id'] = 'EdgeExtension' | 92 params['app_extension_id'] = 'EdgeExtension' |
94 | 93 |
95 app_id = 'app_id_' + metadata_suffix | 94 app_id = 'app_id_' + metadata_suffix |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 if metadata.has_section('appx_assets'): | 185 if metadata.has_section('appx_assets'): |
187 for name, path in metadata.items('appx_assets'): | 186 for name, path in metadata.items('appx_assets'): |
188 path = os.path.join(baseDir, path) | 187 path = os.path.join(baseDir, path) |
189 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) | 188 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) |
190 | 189 |
191 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) | 190 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) |
192 files[BLOCKMAP] = create_appx_blockmap(files) | 191 files[BLOCKMAP] = create_appx_blockmap(files) |
193 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) | 192 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) |
194 | 193 |
195 files.zip(outfile, compression=zipfile.ZIP_STORED) | 194 files.zip(outfile, compression=zipfile.ZIP_STORED) |
OLD | NEW |