| 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 errno | 5 import errno |
| 6 import glob | 6 import glob |
| 7 import io | 7 import io |
| 8 import json | 8 import json |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 if params['type'] == 'gecko': | 127 if params['type'] == 'gecko': |
| 128 templateData['app_id'] = get_app_id(params['releaseBuild'], metadata) | 128 templateData['app_id'] = get_app_id(params['releaseBuild'], metadata) |
| 129 | 129 |
| 130 manifest = template.render(templateData) | 130 manifest = template.render(templateData) |
| 131 | 131 |
| 132 # Normalize JSON structure | 132 # Normalize JSON structure |
| 133 licenseComment = re.compile(r'/\*.*?\*/', re.S) | 133 licenseComment = re.compile(r'/\*.*?\*/', re.S) |
| 134 data = json.loads(re.sub(licenseComment, '', manifest, 1)) | 134 data = json.loads(re.sub(licenseComment, '', manifest, 1)) |
| 135 if '_dummy' in data: | 135 if '_dummy' in data: |
| 136 del data['_dummy'] | 136 del data['_dummy'] |
| 137 manifest = json.dumps(metadata.section_as_dict('manifest', data), | 137 |
| 138 sort_keys=True, indent=2) | 138 metadata.serialize_section_if_present('manifest', data) |
| 139 manifest = json.dumps(data, sort_keys=True, indent=2) |
| 139 | 140 |
| 140 return manifest.encode('utf-8') | 141 return manifest.encode('utf-8') |
| 141 | 142 |
| 142 | 143 |
| 143 def toJson(data): | 144 def toJson(data): |
| 144 return json.dumps( | 145 return json.dumps( |
| 145 data, ensure_ascii=False, sort_keys=True, | 146 data, ensure_ascii=False, sort_keys=True, |
| 146 indent=2, separators=(',', ': ') | 147 indent=2, separators=(',', ': ') |
| 147 ).encode('utf-8') + '\n' | 148 ).encode('utf-8') + '\n' |
| 148 | 149 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 if devenv: | 387 if devenv: |
| 387 add_devenv_requirements(files, metadata, params) | 388 add_devenv_requirements(files, metadata, params) |
| 388 | 389 |
| 389 zipdata = files.zipToString() | 390 zipdata = files.zipToString() |
| 390 signature = None | 391 signature = None |
| 391 pubkey = None | 392 pubkey = None |
| 392 if keyFile != None: | 393 if keyFile != None: |
| 393 signature = signBinary(zipdata, keyFile) | 394 signature = signBinary(zipdata, keyFile) |
| 394 pubkey = getPublicKey(keyFile) | 395 pubkey = getPublicKey(keyFile) |
| 395 writePackage(outFile, pubkey, signature, zipdata) | 396 writePackage(outFile, pubkey, signature, zipdata) |
| LEFT | RIGHT |