Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #!/usr/bin/env python |
michael@0 | 2 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | |
michael@0 | 6 | import sys |
michael@0 | 7 | import json |
michael@0 | 8 | import buildconfig |
michael@0 | 9 | |
michael@0 | 10 | |
michael@0 | 11 | def parse_cmdline(args): |
michael@0 | 12 | """Take a list of strings in the format K=V and turn them into a python |
michael@0 | 13 | dictionary""" |
michael@0 | 14 | contents = {} |
michael@0 | 15 | for arg in args: |
michael@0 | 16 | key, s, value = arg.partition("=") |
michael@0 | 17 | if s == '': |
michael@0 | 18 | print "ERROR: Malformed command line key value pairing (%s)" % arg |
michael@0 | 19 | exit(1) |
michael@0 | 20 | contents[key.lower()] = value |
michael@0 | 21 | return contents |
michael@0 | 22 | |
michael@0 | 23 | |
michael@0 | 24 | def main(): |
michael@0 | 25 | if len(sys.argv) < 2: |
michael@0 | 26 | print "ERROR: You must specify an output file" |
michael@0 | 27 | exit(1) |
michael@0 | 28 | |
michael@0 | 29 | all_key_value_pairs = {} |
michael@0 | 30 | important_substitutions = [ |
michael@0 | 31 | 'target_alias', 'target_cpu', 'target_os', 'target_vendor', |
michael@0 | 32 | 'host_alias', 'host_cpu', 'host_os', 'host_vendor', |
michael@0 | 33 | 'MOZ_UPDATE_CHANNEL', 'MOZ_APP_VENDOR', 'MOZ_APP_NAME', |
michael@0 | 34 | 'MOZ_APP_VERSION', 'MOZ_APP_MAXVERSION', 'MOZ_APP_ID', |
michael@0 | 35 | 'CC', 'CXX', 'LD', 'AS'] |
michael@0 | 36 | |
michael@0 | 37 | all_key_value_pairs = dict([(x.lower(), buildconfig.substs[x]) for x in important_substitutions]) |
michael@0 | 38 | all_key_value_pairs.update(parse_cmdline(sys.argv[2:])) |
michael@0 | 39 | |
michael@0 | 40 | with open(sys.argv[1], "w+") as f: |
michael@0 | 41 | json.dump(all_key_value_pairs, f, indent=2, sort_keys=True) |
michael@0 | 42 | f.write('\n') |
michael@0 | 43 | |
michael@0 | 44 | |
michael@0 | 45 | if __name__=="__main__": |
michael@0 | 46 | main() |