| 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 import subprocess | 5 import subprocess | 
| 6 | 6 | 
| 7 def _CheckSphinxBuild(input_api, output_api): | 7 def _CheckSphinxBuild(input_api, output_api): | 
| 8   """Check that the docs are buildable without any warnings. | 8   """Check that the docs are buildable without any warnings. | 
| 9 | 9 | 
| 10   This check runs sphinx-build with -W so that warning are errors. | 10   This check runs sphinx-build with -W so that warning are errors. | 
| 11 | 11 | 
| 12   However, since the trybots don't have sphinx installed, we'll treat a sphinx | 12   However, since the trybots don't have sphinx installed, we'll treat a sphinx | 
| 13   failure as a warning. (Let's trust that the docs editors are testing locally.) | 13   failure as a warning. (Let's trust that the docs editors are testing locally.) | 
| 14   """ | 14   """ | 
| 15 | 15 | 
| 16   try: | 16   try: | 
| 17     # Don't do a full chromesite build (takes about a minute...), just build | 17     subprocess.check_output(['make', 'presubmit', 'SPHINXOPTS=-Wa'], | 
| 18     # the ReST. |  | 
| 19     subprocess.check_output(['make', 'chromesite_rst', 'SPHINXOPTS=-Wa'], |  | 
| 20                             stderr=subprocess.STDOUT) | 18                             stderr=subprocess.STDOUT) | 
| 21   except subprocess.CalledProcessError as e: | 19   except subprocess.CalledProcessError as e: | 
| 22     return [output_api.PresubmitNotifyResult('sphinx_build failed:\n' + | 20     return [output_api.PresubmitNotifyResult('sphinx_build failed:\n' + | 
| 23             e.output)] | 21             e.output)] | 
| 24 | 22 | 
| 25   return [] | 23   return [] | 
| 26 | 24 | 
| 27 | 25 | 
| 28 def CommonChecks(input_api, output_api): | 26 def CommonChecks(input_api, output_api): | 
| 29   output = [] | 27   output = [] | 
| 30   output.extend(_CheckSphinxBuild(input_api, output_api)) | 28   output.extend(_CheckSphinxBuild(input_api, output_api)) | 
| 31   return output | 29   return output | 
| 32 | 30 | 
| 33 | 31 | 
| 34 def CheckChangeOnUpload(input_api, output_api): | 32 def CheckChangeOnUpload(input_api, output_api): | 
| 35   return CommonChecks(input_api, output_api) | 33   return CommonChecks(input_api, output_api) | 
| 36 | 34 | 
| 37 | 35 | 
| 38 def CheckChangeOnCommit(input_api, output_api): | 36 def CheckChangeOnCommit(input_api, output_api): | 
| 39   return CommonChecks(input_api, output_api) | 37   return CommonChecks(input_api, output_api) | 
| OLD | NEW | 
|---|