OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 """Generic presubmit checks that can be reused by other presubmit checks.""" | 5 """Generic presubmit checks that can be reused by other presubmit checks.""" |
6 | 6 |
7 | 7 |
8 ### Description checks | 8 ### Description checks |
9 | 9 |
10 def CheckChangeHasTestField(input_api, output_api): | 10 def CheckChangeHasTestField(input_api, output_api): |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 # TODO(dpranke): Get the host_url from the input_api instead | 688 # TODO(dpranke): Get the host_url from the input_api instead |
689 def CheckRietveldTryJobExecution(input_api, output_api, host_url, platforms, | 689 def CheckRietveldTryJobExecution(input_api, output_api, host_url, platforms, |
690 owner): | 690 owner): |
691 # Temporarily 'fix' the check while the Rietveld API is being upgraded to | 691 # Temporarily 'fix' the check while the Rietveld API is being upgraded to |
692 # something sensible. | 692 # something sensible. |
693 return [] | 693 return [] |
694 | 694 |
695 | 695 |
696 def CheckBuildbotPendingBuilds(input_api, output_api, url, max_pendings, | 696 def CheckBuildbotPendingBuilds(input_api, output_api, url, max_pendings, |
697 ignored): | 697 ignored): |
698 if not input_api.json: | |
699 return [output_api.PresubmitPromptWarning( | |
700 'Please install simplejson or upgrade to python 2.6+')] | |
701 try: | 698 try: |
702 connection = input_api.urllib2.urlopen(url) | 699 connection = input_api.urllib2.urlopen(url) |
703 raw_data = connection.read() | 700 raw_data = connection.read() |
704 connection.close() | 701 connection.close() |
705 except IOError: | 702 except IOError: |
706 return [output_api.PresubmitNotifyResult('%s is not accessible' % url)] | 703 return [output_api.PresubmitNotifyResult('%s is not accessible' % url)] |
707 | 704 |
708 try: | 705 try: |
709 data = input_api.json.loads(raw_data) | 706 data = input_api.json.loads(raw_data) |
710 except ValueError: | 707 except ValueError: |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( | 935 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( |
939 input_api, output_api)) | 936 input_api, output_api)) |
940 snapshot("checking license") | 937 snapshot("checking license") |
941 results.extend(input_api.canned_checks.CheckLicense( | 938 results.extend(input_api.canned_checks.CheckLicense( |
942 input_api, output_api, license_header, source_file_filter=sources)) | 939 input_api, output_api, license_header, source_file_filter=sources)) |
943 snapshot("checking was uploaded") | 940 snapshot("checking was uploaded") |
944 results.extend(input_api.canned_checks.CheckChangeWasUploaded( | 941 results.extend(input_api.canned_checks.CheckChangeWasUploaded( |
945 input_api, output_api)) | 942 input_api, output_api)) |
946 snapshot("done") | 943 snapshot("done") |
947 return results | 944 return results |
OLD | NEW |