Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / native_client_sdk / src / doc / PRESUBMIT.py
blob35d7bebe8c7d9ef985835c2f9ca4f3d640f87631
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.
5 import subprocess
7 def _CheckSphinxBuild(input_api, output_api):
8 """Check that the docs are buildable without any warnings.
10 This check runs sphinx-build with -W so that warning are errors.
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.)
14 """
16 try:
17 subprocess.check_output(['make', 'presubmit', 'SPHINXOPTS=-Wa'],
18 stderr=subprocess.STDOUT)
19 except subprocess.CalledProcessError as e:
20 return [output_api.PresubmitNotifyResult('sphinx_build failed:\n' +
21 e.output)]
23 return []
26 def CommonChecks(input_api, output_api):
27 output = []
28 output.extend(_CheckSphinxBuild(input_api, output_api))
29 return output
32 def CheckChangeOnUpload(input_api, output_api):
33 return CommonChecks(input_api, output_api)
36 def CheckChangeOnCommit(input_api, output_api):
37 return CommonChecks(input_api, output_api)