OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 import argparse | |
7 import json | |
8 import os | |
9 import sys | |
10 | |
11 import common | |
12 | |
13 | |
14 def main(argv): | |
15 parser = argparse.ArgumentParser() | |
16 parser.add_argument('--output', required=True) | |
17 parser.add_argument('args', nargs=argparse.REMAINDER) | |
18 | |
19 args = parser.parse_args(argv) | |
20 | |
21 passthrough_args = args.args | |
22 if passthrough_args[0] == '--': | |
23 passthrough_args = passthrough_args[1:] | |
24 | |
25 results = {} | |
26 | |
27 for filename in os.listdir(common.SCRIPT_DIR): | |
28 if not filename.endswith('.py'): | |
29 continue | |
30 if filename in ('common.py', 'get_compile_targets.py'): | |
31 continue | |
32 | |
33 with common.temporary_file() as tempfile_path: | |
34 rc = common.run_command( | |
35 [os.path.join(common.SCRIPT_DIR, filename)] + | |
36 passthrough_args + | |
iannucci
2014/10/22 07:23:15
why are passthrough_args before the mode parameter
Paweł Hajdan Jr.
2014/10/22 09:43:27
Suggestions are welcome - I think the reason is th
| |
37 [ | |
38 'compile_targets', | |
39 '--output', tempfile_path | |
40 ] | |
41 ) | |
42 if rc != 0: | |
43 return rc | |
44 | |
45 with open(tempfile_path) as f: | |
46 results[filename] = json.load(f) | |
47 | |
48 with open(args.output, 'w') as f: | |
49 json.dump(results, f) | |
50 | |
51 return 0 | |
52 | |
53 | |
54 if __name__ == '__main__': | |
55 sys.exit(main(sys.argv[1:])) | |
OLD | NEW |