OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import json | 6 import json |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 | 9 |
10 | 10 |
11 import common | 11 import common |
12 | 12 |
13 | 13 |
14 def main_run(args): | 14 def main_run(args): |
15 with common.temporary_file() as tempfile_path: | 15 with common.temporary_file() as tempfile_path: |
16 rc = common.run_command([ | 16 rc = common.run_command([ |
17 os.path.join(common.SRC_DIR, 'tools', 'checklicenses', | 17 os.path.join(common.SRC_DIR, 'android_webview', 'tools', |
18 'checklicenses.py'), | 18 'webview_licenses.py'), |
| 19 'scan', |
19 '--json', tempfile_path | 20 '--json', tempfile_path |
20 ]) | 21 ]) |
21 | 22 |
22 with open(tempfile_path) as f: | 23 with open(tempfile_path) as f: |
23 checklicenses_results = json.load(f) | 24 results = json.load(f) |
24 | |
25 result_set = set() | |
26 for result in checklicenses_results: | |
27 result_set.add((result['filename'], result['license'])) | |
28 | 25 |
29 json.dump({ | 26 json.dump({ |
30 'valid': True, | 27 'valid': True, |
31 'failures': ['%s: %s' % (r[0], r[1]) for r in result_set], | 28 'failures': results, |
32 }, args.output) | 29 }, args.output) |
33 | 30 |
34 return rc | 31 return rc |
35 | 32 |
36 | 33 |
37 def main_compile_targets(args): | 34 def main_compile_targets(args): |
38 json.dump([], args.output) | 35 json.dump([], args.output) |
39 | 36 |
40 | 37 |
41 if __name__ == '__main__': | 38 if __name__ == '__main__': |
42 funcs = { | 39 funcs = { |
43 'run': main_run, | 40 'run': main_run, |
44 'compile_targets': main_compile_targets, | 41 'compile_targets': main_compile_targets, |
45 } | 42 } |
46 sys.exit(common.run_script(sys.argv[1:], funcs)) | 43 sys.exit(common.run_script(sys.argv[1:], funcs)) |
OLD | NEW |