sphinx-build
#SphinxのCommand-Line_Tools
https://www.sphinx-doc.org/ja/master/man/sphinx-build.html
sphinx-build [options] <sourcedir> <outputdir> [filenames ...]
sphinx-build は設定を <sourcedir>/conf.py から探します。
デフォルトでは更新されたファイルだけがビルドされます。個々のファイルを指定すると、その選択されたファイルだけが出力されます。
-M buildername
https://www.sphinx-doc.org/ja/master/man/sphinx-build.html#cmdoption-sphinx-build-M
Alternative to -b.
-bより指定できるものが多い?(latexpdfとか)
-b buildername
https://www.sphinx-doc.org/ja/master/man/sphinx-build.html#cmdoption-sphinx-build-b
ビルダーを選択する、もっとも重要なオプションです。
-d path, --doctree-dir path
Since Sphinx has to read and parse all source files before it can write an output file, the parsed source files are cached as “doctree pickles”.
「Sphinxは出力ファイルに書く前にすべてのソースファイルを読んでパースしなければならないので、パースされたソースファイルは"doctree pickle"としてキャッシュされる」
通常は、これらのファイルはビルドディレクトリの下の .doctrees と呼ばれるディレクトリに置かれます。このオプションを指定すると、キャッシュディレクトリを違う場所に設定できます。
doctreeはすべてのビルダーで共有されます。
-D setting=value, --define setting=value
conf.py ファイルで設定されたコンフィグを上書きします。
-T, --show-traceback
捕捉されない例外が発生した時、完全なトレースバックを表示します。
このオプションがない場合、要約だけが表示され、トレースバックの情報は今後の解析のためにファイルとして保存されます。
-P, --pdb
(Sphinx自体のデバッグをする人用) キャッチされない例外がビルド中に発生したら、Pythonデバッガの pdb を実行します。
--exception-on-warning(8.1で追加)と合わせて
-j, --jobs
Distribute the build over N processes in parallel, to make building on multiprocessor machines more effective.
値としてautoも指定できる
👉parallel_read_safeが絡む(Sphinx Extensions APIのメタデータ)
-W, --fail-on-warning
警告をエラーにします
--keep-goingと合わせて(デフォルトで有効っぽい)
conf.pyのsupress_warningsにないwarningをerrorにして使った(Options for warning control (Sphinx))
https://nikkie-ftnext.hatenablog.com/entry/sphinx-build-suppress-warnings-and-fail-on-warning
Makefileについてもドキュメントがある(TODO)
実装 https://github.com/sphinx-doc/sphinx/blob/v7.2.6/sphinx/cmd/build.py#L325