Sphinxのmake htmlは、ERRORが発生してるのに成功(終了ステータス0)になる場合がある?
やりたこと
(13日目) Jenkins + bitbucket.org で Sphinx で作られた Web サイトを自動公開する
こんな感じに、JenkinsからSphinxのビルドをしたい。
Jenkinsを使って、ビルドをできるようにはできた。
でも、ERRORが発生してるのにビルドエラーならない。
ERRORが発生した場合に、ちゃんとビルドエラーになるかを確認しようとして、
reSTファイルをおかしな状態に修正した。
コンソールにはERROR:がでてる。
でもビルドのエラーにならない。
ERROR:が出てたら、ビルドエラーにしたい。
現象
- 試したreSTファイル
$ cat index.rst .. Test documentation master file, created by sphinx-quickstart on Sat Nov 24 19:19:02 2012. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Welcome to Test's documentation! ======================================= Contents: .. toctree:: :maxdepth: 2 .. NOTEXSIST:: aaa aaa --- あああああ ----- Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search`
- makeの結果
$ make clean html rm -rf build/* sphinx-build -b html -d build/doctrees source build/html Making output directory... Running Sphinx v1.1.3 loading pickled environment... not yet created building [html]: targets for 1 source files that are out of date updating environment: 1 added, 0 changed, 0 removed reading sources... [100%] index /home/oc/workspace/sphinx_sandbox/source/index.rst:14: ERROR: Unknown directive type "NOTEXSIST". .. git:: /home/oc/workspace/sphinx_sandbox/source/index.rst:15: WARNING: Explicit markup ends without a blank line; unexpected unindent. looking for now-outdated files... none found pickling environment... done checking consistency... done preparing documents... done writing output... [100%] index writing additional files... genindex search copying static files... done dumping search index... done dumping object inventory... done build succeeded, 2 warnings. Build finished. The HTML pages are in build/html.
終了ステータスの確認
$ echo $? 0
原因
make htmlの終了ステータスが0になってる。
この設定で動かしていて、ビルドエラーが起きた時は make のところで止まってエラーメールが届いていました。
エラーが起きた状態のままデプロイ(rsync)が動くということはなかったのですが、なにか勘違いしていますか?
(13日目) Jenkins + bitbucket.org で Sphinx で作られた Web サイトを自動公開するに
上記のコメントがあるから、エラーが発生したら、makeがエラーになると思ったんだけど。
#!/usr/bin/python # -*- coding: utf-8 -*- """ Sphinx - Python documentation toolchain ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import sys if __name__ == '__main__': from sphinx import main sys.exit(main(sys.argv))
sphinx-buildは、ERROR:が発生していても、htmlなどドキュメントが生成できる場合は、
終了ステータス0なのか?
Jenkinsからビルドするとすると気づかないな。
ログからERROR:を拾うか。
なにかおかしな点があれば、コメント、トラックバック、はてブ、Twitter @orange_clover宛 で、
教えて下さい。