blob: 43342d0254660446a56231ce55513c2e38b5ae8e [file] [log] [blame]
James Robinson5e66a792015-01-21 17:02:08 -08001#!/usr/bin/env python
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
4# found in the LICENSE file.
5
6import json
7import os
8import sys
9
10
11import common
12
13
14def main_run(args):
15 with common.temporary_file() as tempfile_path:
16 rc = common.run_command([
17 os.path.join(common.SRC_DIR, 'tools', 'checklicenses',
18 'checklicenses.py'),
19 '--json', tempfile_path
20 ])
21
22 with open(tempfile_path) as f:
23 checklicenses_results = json.load(f)
24
25 result_set = set()
26 for result in checklicenses_results:
27 result_set.add((result['filename'], result['license']))
28
29 json.dump({
30 'valid': True,
31 'failures': ['%s: %s' % (r[0], r[1]) for r in result_set],
32 }, args.output)
33
34 return rc
35
36
37def main_compile_targets(args):
38 json.dump([], args.output)
39
40
41if __name__ == '__main__':
42 funcs = {
43 'run': main_run,
44 'compile_targets': main_compile_targets,
45 }
46 sys.exit(common.run_script(sys.argv[1:], funcs))