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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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')) | 85 params.update(metadata.items('general')) |
86 params['version'] = pad_version(params['version']) | 86 params['version'] = pad_version(params['version']) |
87 params['app_extension_id'] = '1.0' if release_build else 'EdgeExtension' | 87 |
Wladimir Palant
2016/12/16 10:39:25
Given that this logic isn't something that is inhe
Sebastian Noack
2016/12/16 11:20:11
I already had the same thought. But on the other h
Sebastian Noack
2016/12/19 17:19:52
Yes, it is permanent for Adblock Plus for Microsof
Wladimir Palant
2017/01/05 12:20:49
I don't really see what this discussion is about.
Sebastian Noack
2017/01/05 12:27:57
Thanks for getting back to us. As I said above, I
wspee
2017/01/06 16:18:10
I have made it configure able similar to how you s
Sebastian Noack
2017/01/07 10:18:46
I think it makes sense to use 'EdgeExtension' as d
wspee
2017/01/09 13:32:27
Done.
| |
88 metadata_id_suffix = 'release' if release_build else 'devbuild' | |
89 metadata_id = 'extension_id_' + metadata_id_suffix | |
90 if metadata.has_option('general', metadata_id): | |
91 params['app_extension_id'] = metadata.get('general', metadata_id) | |
92 else: | |
93 params['app_extension_id'] = 'EdgeExtension' | |
88 | 94 |
89 translation = load_translation(files, defaultLocale) | 95 translation = load_translation(files, defaultLocale) |
90 name_key = 'name' if release_build else 'name_devbuild' | 96 name_key = 'name' if release_build else 'name_devbuild' |
91 params['display_name'] = translation[name_key]['message'] | 97 params['display_name'] = translation[name_key]['message'] |
92 params['description'] = translation['description']['message'] | 98 params['description'] = translation['description']['message'] |
93 | 99 |
94 for size in ['44', '50', '150']: | 100 for size in ['44', '50', '150']: |
95 path = '{}/logo_{}.png'.format(ASSETS_DIR, size) | 101 path = '{}/logo_{}.png'.format(ASSETS_DIR, size) |
96 if path not in files: | 102 if path not in files: |
97 raise KeyError(path + ' is not found in files') | 103 raise KeyError(path + ' is not found in files') |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 packagerChrome.convertJS(params, files) | 171 packagerChrome.convertJS(params, files) |
166 | 172 |
167 if metadata.has_section('preprocess'): | 173 if metadata.has_section('preprocess'): |
168 files.preprocess(metadata.options('preprocess'), {'needsExt': True}) | 174 files.preprocess(metadata.options('preprocess'), {'needsExt': True}) |
169 | 175 |
170 if metadata.has_section('import_locales'): | 176 if metadata.has_section('import_locales'): |
171 packagerChrome.importGeckoLocales(params, files) | 177 packagerChrome.importGeckoLocales(params, files) |
172 | 178 |
173 files['manifest.json'] = packagerChrome.createManifest(params, files) | 179 files['manifest.json'] = packagerChrome.createManifest(params, files) |
174 | 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) | |
185 | |
175 move_files_to_extension(files) | 186 move_files_to_extension(files) |
176 | 187 |
177 if metadata.has_section('appx_assets'): | 188 if metadata.has_section('appx_assets'): |
178 for name, path in metadata.items('appx_assets'): | 189 for name, path in metadata.items('appx_assets'): |
179 path = os.path.join(baseDir, path) | 190 path = os.path.join(baseDir, path) |
180 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) | 191 files.read(path, '{}/{}'.format(ASSETS_DIR, name)) |
181 | 192 |
182 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) | 193 files[MANIFEST] = create_appx_manifest(params, files, releaseBuild) |
183 files[BLOCKMAP] = create_appx_blockmap(files) | 194 files[BLOCKMAP] = create_appx_blockmap(files) |
184 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) | 195 files[CONTENT_TYPES] = create_content_types_map(files.keys() + [BLOCKMAP]) |
185 | 196 |
186 files.zip(outfile, compression=zipfile.ZIP_STORED) | 197 files.zip(outfile, compression=zipfile.ZIP_STORED) |
LEFT | RIGHT |