Index: native_client_sdk/src/doc/PRESUBMIT.py |
diff --git a/native_client_sdk/src/doc/PRESUBMIT.py b/native_client_sdk/src/doc/PRESUBMIT.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..22dceb7528d3797841c9418ade2e794b407da937 |
--- /dev/null |
+++ b/native_client_sdk/src/doc/PRESUBMIT.py |
@@ -0,0 +1,33 @@ |
+# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
binji
2013/09/05 00:52:51
2013
|
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import subprocess |
+ |
+def _CheckSphinxBuild(input_api, output_api): |
binji
2013/09/05 00:52:51
I assume this is only run if a file in the docs di
|
+ """Check that the docs are buildable without any warnings. |
+ |
+ This check runs sphinx-build with -W so that warning are errors. |
+ """ |
+ |
+ try: |
+ subprocess.check_output(['make', 'SPHINXOPTS=-Wa']) |
+ except subprocess.CalledProcessError as e: |
+ return [output_api.PresubmitPromptError('sphinx_build failed:\n' + |
+ e.output)] |
+ |
+ return [] |
+ |
+ |
+def CommonChecks(input_api, output_api): |
+ output = [] |
+ output.extend(_CheckSphinxBuild(input_api, output_api)) |
+ return output |
+ |
+ |
+def CheckChangeOnUpload(input_api, output_api): |
+ return CommonChecks(input_api, output_api) |
+ |
+ |
+def CheckChangeOnCommit(input_api, output_api): |
+ return CommonChecks(input_api, output_api) |