1# Copyright (c) 2012 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Top-level presubmit script for isolate.
6
7See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
8details on the presubmit API built into gcl.
9"""
10
11
12def CommonChecks(input_api, output_api):
13  output = []
14  disabled_warnings = [
15    'F0401',  # Unable to import module
16    'R0401',  # Cyclic import
17    'W0613',  # Unused argument
18    'E1103',  # subprocess.communicate() generates these :(
19    'R0201',  # method could be function (doesn't reference self)
20  ]
21  black_list = [
22    r'src[\\\/]build_tools[\\\/]tests[\\\/].*',
23    r'src[\\\/]build_tools[\\\/]sdk_tools[\\\/]third_party[\\\/].*',
24    r'src[\\\/]doc[\\\/]*',
25    r'src[\\\/]gonacl_appengine[\\\/]*',
26  ]
27  canned = input_api.canned_checks
28  output.extend(canned.RunPylint(input_api, output_api, black_list=black_list,
29                disabled_warnings=disabled_warnings))
30  return output
31
32
33def CheckChangeOnUpload(input_api, output_api):
34  return CommonChecks(input_api, output_api)
35
36
37def CheckChangeOnCommit(input_api, output_api):
38  return CommonChecks(input_api, output_api)
39
40
41def GetPreferredTryMasters(project, change):
42  return {
43    'tryserver.chromium.linux': {
44      'linux_nacl_sdk': set(['defaulttests']),
45      'linux_nacl_sdk_build': set(['defaulttests']),
46    },
47    'tryserver.chromium.win': {
48      'win_nacl_sdk': set(['defaulttests']),
49      'win_nacl_sdk_build': set(['defaulttests']),
50    },
51    'tryserver.chromium.mac': {
52      'mac_nacl_sdk': set(['defaulttests']),
53      'mac_nacl_sdk_build': set(['defaulttests']),
54    }
55  }
56