1#!/usr/bin/env python 2# Copyright 2015 The Chromium Authors 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 10import common 11 12 13def main_run(args): 14 with common.temporary_file() as tempfile_path: 15 rc = common.run_command([ 16 os.path.join(common.SRC_DIR, 'tools', 'checkperms', 'checkperms.py'), 17 '--root', args.paths['checkout'], '--json', tempfile_path 18 ]) 19 20 with open(tempfile_path) as f: 21 checkperms_results = json.load(f) 22 23 result_set = set() 24 for result in checkperms_results: 25 result_set.add((result['rel_path'], result['error'])) 26 27 failures = ['%s: %s' % (r[0], r[1]) for r in result_set] 28 common.record_local_script_results('checkperms', args.output, failures, True) 29 30 return rc 31 32 33def main_compile_targets(args): 34 json.dump([], args.output) 35 36 37if __name__ == '__main__': 38 funcs = { 39 'run': main_run, 40 'compile_targets': main_compile_targets, 41 } 42 sys.exit(common.run_script(sys.argv[1:], funcs)) 43