OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 """Enables directory-specific presubmit checks to run at upload and/or commit. | 6 """Enables directory-specific presubmit checks to run at upload and/or commit. |
7 """ | 7 """ |
8 | 8 |
9 __version__ = '1.4' | 9 __version__ = '1.4' |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 if items: | 139 if items: |
140 self._items = items | 140 self._items = items |
141 self._long_text = long_text.rstrip() | 141 self._long_text = long_text.rstrip() |
142 | 142 |
143 def handle(self, output): | 143 def handle(self, output): |
144 output.write(self._message) | 144 output.write(self._message) |
145 output.write('\n') | 145 output.write('\n') |
146 for index, item in enumerate(self._items): | 146 for index, item in enumerate(self._items): |
147 output.write(' ') | 147 output.write(' ') |
148 # Write separately in case it's unicode. | 148 # Write separately in case it's unicode. |
149 output.write(item) | 149 output.write(str(item)) |
150 if index < len(self._items) - 1: | 150 if index < len(self._items) - 1: |
151 output.write(' \\') | 151 output.write(' \\') |
152 output.write('\n') | 152 output.write('\n') |
153 if self._long_text: | 153 if self._long_text: |
154 output.write('\n***************\n') | 154 output.write('\n***************\n') |
155 # Write separately in case it's unicode. | 155 # Write separately in case it's unicode. |
156 output.write(self._long_text) | 156 output.write(self._long_text) |
157 output.write('\n***************\n') | 157 output.write('\n***************\n') |
158 if self.fatal: | 158 if self.fatal: |
159 output.fail() | 159 output.fail() |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 sys.stdout, | 1188 sys.stdout, |
1189 sys.stdin, | 1189 sys.stdin, |
1190 options.default_presubmit, | 1190 options.default_presubmit, |
1191 options.may_prompt) | 1191 options.may_prompt) |
1192 return not results.should_continue() | 1192 return not results.should_continue() |
1193 | 1193 |
1194 | 1194 |
1195 if __name__ == '__main__': | 1195 if __name__ == '__main__': |
1196 fix_encoding.fix_encoding() | 1196 fix_encoding.fix_encoding() |
1197 sys.exit(Main(None)) | 1197 sys.exit(Main(None)) |
OLD | NEW |