OLD | NEW |
---|---|
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 """Top-level presubmit script for GYP. | 6 """Top-level presubmit script for GYP. |
7 | 7 |
8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
9 for more details about the presubmit API built into gcl. | 9 for more details about the presubmit API built into gcl. |
10 """ | 10 """ |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 'R0401', | 66 'R0401', |
67 # Others, too many to sort. | 67 # Others, too many to sort. |
68 'W0201', 'W0232', 'E1103', 'W0621', 'W0108', 'W0223', 'W0231', | 68 'W0201', 'W0232', 'E1103', 'W0621', 'W0108', 'W0223', 'W0231', |
69 'R0201', 'E0101', 'C0321', | 69 'R0201', 'E0101', 'C0321', |
70 # ************* Module copy | 70 # ************* Module copy |
71 # W0104:427,12:_test.odict.__setitem__: Statement seems to have no effect | 71 # W0104:427,12:_test.odict.__setitem__: Statement seems to have no effect |
72 'W0104', | 72 'W0104', |
73 ] | 73 ] |
74 | 74 |
75 | 75 |
76 def CheckChangeOnUpload(input_api, output_api): | 76 def _LicenseHeader(input_api): |
77 report = [] | |
78 report.extend(input_api.canned_checks.PanProjectChecks( | |
79 input_api, output_api)) | |
80 return report | |
81 | |
82 | |
83 def CheckChangeOnCommit(input_api, output_api): | |
84 report = [] | |
85 | |
86 # Accept any year number from 2009 to the current year. | 77 # Accept any year number from 2009 to the current year. |
87 current_year = int(input_api.time.strftime('%Y')) | 78 current_year = int(input_api.time.strftime('%Y')) |
88 allowed_years = (str(s) for s in reversed(xrange(2009, current_year + 1))) | 79 allowed_years = (str(s) for s in reversed(xrange(2009, current_year + 1))) |
80 | |
89 years_re = '(' + '|'.join(allowed_years) + ')' | 81 years_re = '(' + '|'.join(allowed_years) + ')' |
90 | 82 |
91 # The (c) is deprecated, but tolerate it until it's removed from all files. | 83 # The (c) is deprecated, but tolerate it until it's removed from all files. |
92 license = ( | 84 return ( |
93 r'.*? Copyright (\(c\) )?%(year)s Google Inc\. All rights reserved\.\n' | 85 r'.*? Copyright (\(c\) )?%(year)s Google Inc\. All rights reserved\.\n' |
94 r'.*? Use of this source code is governed by a BSD-style license that ' | 86 r'.*? Use of this source code is governed by a BSD-style license that ' |
95 r'can be\n' | 87 r'can be\n' |
96 r'.*? found in the LICENSE file\.\n' | 88 r'.*? found in the LICENSE file\.\n' |
97 ) % { | 89 ) % { |
98 'year': years_re, | 90 'year': years_re, |
99 } | 91 } |
100 | 92 |
93 def CheckChangeOnUpload(input_api, output_api): | |
94 report = [] | |
101 report.extend(input_api.canned_checks.PanProjectChecks( | 95 report.extend(input_api.canned_checks.PanProjectChecks( |
102 input_api, output_api, license_header=license)) | 96 input_api, output_api, license_header=_LicenseHeader(input_api))) |
Dirk Pranke
2016/11/17 21:14:22
Apparently we were looking for difference licenses
| |
97 return report | |
98 | |
99 | |
100 def CheckChangeOnCommit(input_api, output_api): | |
101 report = [] | |
102 | |
103 report.extend(input_api.canned_checks.PanProjectChecks( | |
104 input_api, output_api, license_header=_LicenseHeader(input_api))) | |
103 report.extend(input_api.canned_checks.CheckTreeIsOpen( | 105 report.extend(input_api.canned_checks.CheckTreeIsOpen( |
104 input_api, output_api, | 106 input_api, output_api, |
105 'http://gyp-status.appspot.com/status', | 107 'http://gyp-status.appspot.com/status', |
106 'http://gyp-status.appspot.com/current')) | 108 'http://gyp-status.appspot.com/current')) |
107 | 109 |
108 import os | 110 import os |
109 import sys | 111 import sys |
110 old_sys_path = sys.path | 112 old_sys_path = sys.path |
111 try: | 113 try: |
112 sys.path = ['pylib', 'test/lib'] + sys.path | 114 sys.path = ['pylib', 'test/lib'] + sys.path |
(...skipping 15 matching lines...) Expand all Loading... | |
128 'linux_try', | 130 'linux_try', |
129 'mac_try', | 131 'mac_try', |
130 'win_try', | 132 'win_try', |
131 ] | 133 ] |
132 | 134 |
133 | 135 |
134 def GetPreferredTryMasters(_, change): | 136 def GetPreferredTryMasters(_, change): |
135 return { | 137 return { |
136 'client.gyp': { t: set(['defaulttests']) for t in TRYBOTS }, | 138 'client.gyp': { t: set(['defaulttests']) for t in TRYBOTS }, |
137 } | 139 } |
OLD | NEW |