From 1ebc74f0a6dd438adbd26e618668b6e2210b3620 Mon Sep 17 00:00:00 2001 From: Shengyu Zhang Date: Mon, 8 Jul 2024 20:04:55 +0800 Subject: [PATCH] fix: Use same doctree dir --- docs/Makefile | 8 +++++--- docs/conf.py | 12 ++++++------ docs/index.rst | 2 +- utils/bench.sh | 8 ++++---- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index 1acebe9..3ef4fef 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -9,7 +9,7 @@ SPHINXBUILD = python3 -msphinx SOURCEDIR = . BUILDDIR = _build -default: fast +default: fasthtml # Put it first so that "make" without argument is like "make help". help: @@ -22,5 +22,7 @@ help: %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -fast: Makefile - @$(SPHINXBUILD) -b fasthtml "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) $(O) +# Without "make mode" we can specify OUTPUTDIR and DOCTREEDIR precisely +# so that we can make sure to share all output with the HTML builder. +fasthtml: Makefile + @$(SPHINXBUILD) -b $@ "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) $(O) -d "$(BUILDDIR)/doctrees" diff --git a/docs/conf.py b/docs/conf.py index ef4344b..6fd9547 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -131,12 +131,12 @@ autoclass_content = 'init' autodoc_typehints = 'description' -extensions.append('sphinx.ext.intersphinx') -intersphinx_mapping = { - 'python': ('https://docs.python.org/3', None), - 'sphinx': ('https://www.sphinx-doc.org/en/master', None), - 'jinja': ('https://jinja.palletsprojects.com/en/latest/', None), -} +# extensions.append('sphinx.ext.intersphinx') +# intersphinx_mapping = { +# 'python': ('https://docs.python.org/3', None), +# 'sphinx': ('https://www.sphinx-doc.org/en/master', None), +# 'jinja': ('https://jinja.palletsprojects.com/en/latest/', None), +# } # extensions.append('sphinxnotes.comboroles') diff --git a/docs/index.rst b/docs/index.rst index c769f1f..0a4a47a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -84,7 +84,7 @@ builtin ``html`` builder: :language: make :lines: 25- -Then use ``make fast`` to run the fast HTML build. +Then use ``make fasthtml`` to run the fast HTML build. .. ADDITIONAL CONTENT END diff --git a/utils/bench.sh b/utils/bench.sh index 64f0767..940f565 100755 --- a/utils/bench.sh +++ b/utils/bench.sh @@ -19,10 +19,10 @@ compare() { make SPHINXOPTS=-Q html echo ">>> Fast build" echo "Another line" >> index.rst - time make SPHINXOPTS=-Q fast + time make SPHINXOPTS=-Q html echo ">>> Standard build" echo "Another line" >> index.rst - time make SPHINXOPTS=-Q html + time make SPHINXOPTS=-Q fasthtml } echo "=== Sphinx" @@ -30,8 +30,8 @@ git clone --quiet --branch v7.3.7 --depth 1 https://github.com/sphinx-doc/sphinx cd sphinx/doc echo "extensions.append('sphinxnotes.fasthtml')" >> conf.py cat <<'EOF' >> Makefile -fast: Makefile - @$(SPHINXBUILD) -b fasthtml "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) $(O) +fasthtml: Makefile + @$(SPHINXBUILD) -b $@ "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) $(O) -d "$(BUILDDIR)/doctrees" EOF compare cd ..