| 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 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 process = subprocess.Popen(cmd, stdout=subprocess.PIPE, | 192 process = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
| 193 stdin=subprocess.PIPE) | 193 stdin=subprocess.PIPE) |
| 194 output = process.communicate(input=toJson(configuration))[0] | 194 output = process.communicate(input=toJson(configuration))[0] |
| 195 if process.returncode != 0: | 195 if process.returncode != 0: |
| 196 raise subprocess.CalledProcessError(process.returncode, cmd=cmd) | 196 raise subprocess.CalledProcessError(process.returncode, cmd=cmd) |
| 197 output = json.loads(output) | 197 output = json.loads(output) |
| 198 | 198 |
| 199 # Clear the mapping for any files included in a bundle, to avoid them being | 199 # Clear the mapping for any files included in a bundle, to avoid them being |
| 200 # duplicated in the build. | 200 # duplicated in the build. |
| 201 for to_ignore in output['included']: | 201 for to_ignore in output['included']: |
| 202 if to_ignore in files: | 202 files.pop(to_ignore, None) |
| 203 del files[to_ignore] | |
|
Sebastian Noack
2017/10/12 23:23:28
You can use files.pop(to_ignore, None), then you d
kzar
2017/10/13 07:25:21
Yea we can do it that way too, Done.
| |
| 204 | 203 |
| 205 for bundle in output['files']: | 204 for bundle in output['files']: |
| 206 files[bundle] = output['files'][bundle].encode('utf-8') | 205 files[bundle] = output['files'][bundle].encode('utf-8') |
| 207 | 206 |
| 208 | 207 |
| 209 def import_locales(params, files): | 208 def import_locales(params, files): |
| 210 for item in params['metadata'].items('import_locales'): | 209 for item in params['metadata'].items('import_locales'): |
| 211 filename, keys = item | 210 filename, keys = item |
| 212 for sourceFile in glob.glob(os.path.join(os.path.dirname(item.source), | 211 for sourceFile in glob.glob(os.path.join(os.path.dirname(item.source), |
| 213 *filename.split('/'))): | 212 *filename.split('/'))): |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 params, 'testIndex.html.tmpl', ('general', 'testScripts') | 373 params, 'testIndex.html.tmpl', ('general', 'testScripts') |
| 375 ) | 374 ) |
| 376 | 375 |
| 377 zipdata = files.zipToString() | 376 zipdata = files.zipToString() |
| 378 signature = None | 377 signature = None |
| 379 pubkey = None | 378 pubkey = None |
| 380 if keyFile != None: | 379 if keyFile != None: |
| 381 signature = signBinary(zipdata, keyFile) | 380 signature = signBinary(zipdata, keyFile) |
| 382 pubkey = getPublicKey(keyFile) | 381 pubkey = getPublicKey(keyFile) |
| 383 writePackage(outFile, pubkey, signature, zipdata) | 382 writePackage(outFile, pubkey, signature, zipdata) |
| LEFT | RIGHT |