Added help command to sphinx Makefile (#6024)

Co-authored-by: Bruno Alla <alla.brunoo@gmail.com>
This commit is contained in:
Matthew Foster Walsh 2025-09-23 10:46:11 -06:00 committed by GitHub
parent 2e4f4dd4de
commit 69e1d9603e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 13 deletions

View File

@ -3,24 +3,21 @@
# You can set these variables from the command line. # You can set these variables from the command line.
SPHINXOPTS = SPHINXOPTS =
SPHINXBUILD = uv run sphinx-build SPHINXBUILD = uv run --group docs sphinx-build
SOURCEDIR = . SOURCEDIR = .
BUILDDIR = _build BUILDDIR = _build
.PHONY: help clean html livehtml linkcheck .PHONY: help clean livehtml linkcheck
help: help:
@echo "Please use \`make <target>' where <target> is one of" @echo "Please use \`make <target>' where <target> is one of"
@echo "html Build the docs as HTML"
@awk '/^#/{c=substr($$0,3);next}c&&/^[[:alpha:]][[:alnum:]_-]+:/{print substr($$1,1,index($$1,":")),c}1{c=0}' $(MAKEFILE_LIST) | column -s: -t @awk '/^#/{c=substr($$0,3);next}c&&/^[[:alpha:]][[:alnum:]_-]+:/{print substr($$1,1,index($$1,":")),c}1{c=0}' $(MAKEFILE_LIST) | column -s: -t
# Clean the build output # Clean the build output
clean: clean:
-rm -rf $(BUILDDIR)/* -rm -rf $(BUILDDIR)/*
# Build the HTML docs
html:
$(SPHINXBUILD) -b html $(SPHINXOPTS) $(SOURCEDIR) $(BUILDDIR)/html
# Build and serve docs with live reload # Build and serve docs with live reload
livehtml: livehtml:
sphinx-autobuild -b html --port 9000 --watch . -c . $(SOURCEDIR) $(BUILDDIR)/html sphinx-autobuild -b html --port 9000 --watch . -c . $(SOURCEDIR) $(BUILDDIR)/html
@ -31,3 +28,8 @@ linkcheck:
@echo @echo
@echo "Link check complete; look for any errors in the above output " \ @echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt." "or in $(BUILDDIR)/linkcheck/output.txt."
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%:
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -c .

View File

@ -13,11 +13,11 @@ APP = /app
APP = ../{{cookiecutter.project_slug}} APP = ../{{cookiecutter.project_slug}}
{% endif %} {% endif %}
.PHONY: html livehtml apidocs Makefile .PHONY: help livehtml apidocs Makefile
# Put it first so that "make" without argument is like "make html". # Put it first so that "make" without argument is like "make help".
html: help:
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -c . @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -c .
# Build, watch and serve docs with live reload # Build, watch and serve docs with live reload
livehtml: livehtml:

View File

@ -12,7 +12,7 @@ set SOURCEDIR=_source
set BUILDDIR=_build set BUILDDIR=_build
set APP=..\{{cookiecutter.project_slug}} set APP=..\{{cookiecutter.project_slug}}
if "%1" == "" goto html if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL %SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 ( if errorlevel 9009 (
@ -39,8 +39,8 @@ GOTO :EOF
sphinx-apidoc -o %SOURCEDIR%/api %APP% sphinx-apidoc -o %SOURCEDIR%/api %APP%
GOTO :EOF GOTO :EOF
:html :help
%SPHINXBUILD% -b html %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end :end
popd popd