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 ConfigParser | 5 import ConfigParser |
6 import errno | 6 import errno |
7 import glob | 7 import glob |
8 import io | 8 import io |
9 import json | 9 import json |
10 import os | 10 import os |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 if metadata.has_section('preprocess'): | 385 if metadata.has_section('preprocess'): |
386 files.preprocess( | 386 files.preprocess( |
387 [f for f, _ in metadata.items('preprocess')], | 387 [f for f, _ in metadata.items('preprocess')], |
388 {'needsExt': True}, | 388 {'needsExt': True}, |
389 ) | 389 ) |
390 | 390 |
391 if metadata.has_section('import_locales'): | 391 if metadata.has_section('import_locales'): |
392 import_locales(params, files) | 392 import_locales(params, files) |
393 | 393 |
394 files['manifest.json'] = createManifest(params, files) | 394 files['manifest.json'] = createManifest(params, files) |
| 395 building_from_git = os.path.exists(os.path.join(baseDir, '.git')) |
| 396 if not releaseBuild and not devenv and building_from_git: |
| 397 cmd = ['git', 'rev-parse', 'HEAD'] |
| 398 files['.revision'] = subprocess.check_output(cmd, cwd=baseDir) |
| 399 |
395 if type == 'chrome': | 400 if type == 'chrome': |
396 fix_translations_for_chrome(files) | 401 fix_translations_for_chrome(files) |
397 | 402 |
398 if devenv: | 403 if devenv: |
399 add_devenv_requirements(files, metadata, params) | 404 add_devenv_requirements(files, metadata, params) |
400 | 405 |
401 zipdata = files.zipToString() | 406 zipdata = files.zipToString() |
402 signature = None | 407 signature = None |
403 pubkey = None | 408 pubkey = None |
404 if keyFile != None: | 409 if keyFile != None: |
405 signature = signBinary(zipdata, keyFile) | 410 signature = signBinary(zipdata, keyFile) |
406 pubkey = getPublicKey(keyFile) | 411 pubkey = getPublicKey(keyFile) |
407 writePackage(outFile, pubkey, signature, zipdata) | 412 writePackage(outFile, pubkey, signature, zipdata) |
OLD | NEW |