diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cdab904df..a815406ab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -96,7 +96,7 @@ cd doc Run the doc build to build the web page files, and host a webserver to preview: ```commandline -make serve +python ./make.py serve ``` You can now open [http://localhost:8000](http://localhost:8000) in your browser to preview the docs. @@ -116,7 +116,7 @@ cd doc Run the doc build to build the web page files: ```commandline -make html +python ./make.py html ``` The `build/html` directory will contain the generated website files. diff --git a/doc/Makefile b/doc/Makefile deleted file mode 100644 index 7eed56503..000000000 --- a/doc/Makefile +++ /dev/null @@ -1,197 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -SPHINXAUTOBUILD = sphinx-autobuild -PAPER = -BUILDDIR = build - -# User-friendly check for sphinx-build -ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) -$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) -endif - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -SPHINXAUTOBUILDOPTS = --watch ../arcade -# the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " applehelp to make an Apple Help Book" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" - @echo " gettext to make PO message catalogs" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " xml to make Docutils-native XML files" - @echo " pseudoxml to make pseudoxml-XML files for display purposes" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - @echo " coverage to run coverage check of the documentation (if enabled)" - -clean: - rm -rf $(BUILDDIR)/* - -html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -serve: - $(SPHINXAUTOBUILD) $(SPHINXAUTOBUILDOPTS) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - -dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Arcade.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Arcade.qhc" - -applehelp: - $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp - @echo - @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." - @echo "N.B. You won't be able to view it unless you put it in" \ - "~/Library/Documentation/Help or install it in your application" \ - "bundle." - -devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/Arcade" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Arcade" - @echo "# devhelp" - -epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -latexpdfja: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through platex and dvipdfmx..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -texinfo: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." - @echo "Run \`make' in that directory to run these through makeinfo" \ - "(use \`make info' here to do that automatically)." - -info: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." - -gettext: - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." - -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." - -coverage: - $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage - @echo "Testing of coverage in the sources finished, look at the " \ - "results in $(BUILDDIR)/coverage/python.txt." - -xml: - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml - @echo - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." - -pseudoxml: - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml - @echo - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/doc/make.bat b/doc/make.bat deleted file mode 100644 index cc40102a6..000000000 --- a/doc/make.bat +++ /dev/null @@ -1,263 +0,0 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -set SPHINXBUILD=sphinx-build -set BUILDDIR=build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . -echo "Options " %ALLSPHINXOPTS% -set I18NSPHINXOPTS=%SPHINXOPTS% . -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% - set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. singlehtml to make a single large HTML file - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. devhelp to make HTML files and a Devhelp project - echo. epub to make an epub - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. text to make text files - echo. man to make manual pages - echo. texinfo to make Texinfo files - echo. gettext to make PO message catalogs - echo. changes to make an overview over all changed/added/deprecated items - echo. xml to make Docutils-native XML files - echo. pseudoxml to make pseudoxml-XML files for display purposes - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - echo. coverage to run coverage check of the documentation if enabled - goto end -) - -if "%1" == "clean" ( - for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i - del /q /s %BUILDDIR%\* - goto end -) - - -REM Check if sphinx-build is available and fallback to Python version if any -%SPHINXBUILD% 2> nul -if errorlevel 9009 goto sphinx_python -goto sphinx_ok - -:sphinx_python - -set SPHINXBUILD=python -m sphinx.__init__ -%SPHINXBUILD% 2> nul -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -:sphinx_ok - - -if "%1" == "html" ( - echo %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. - goto end -) - -if "%1" == "singlehtml" ( - %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in %BUILDDIR%/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Arcade.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Arcade.ghc - goto end -) - -if "%1" == "devhelp" ( - %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. - goto end -) - -if "%1" == "epub" ( - %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The epub file is in %BUILDDIR%/epub. - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "latexpdf" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - cd %BUILDDIR%/latex - make all-pdf - cd %~dp0 - echo. - echo.Build finished; the PDF files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "latexpdfja" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - cd %BUILDDIR%/latex - make all-pdf-ja - cd %~dp0 - echo. - echo.Build finished; the PDF files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "text" ( - %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The text files are in %BUILDDIR%/text. - goto end -) - -if "%1" == "man" ( - %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The manual pages are in %BUILDDIR%/man. - goto end -) - -if "%1" == "texinfo" ( - %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. - goto end -) - -if "%1" == "gettext" ( - %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The message catalogs are in %BUILDDIR%/locale. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes - if errorlevel 1 exit /b 1 - echo. - echo.The overview file is in %BUILDDIR%/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck - if errorlevel 1 exit /b 1 - echo. - echo.Link check complete; look for any errors in the above output ^ -or in %BUILDDIR%/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest - if errorlevel 1 exit /b 1 - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in %BUILDDIR%/doctest/output.txt. - goto end -) - -if "%1" == "coverage" ( - %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage - if errorlevel 1 exit /b 1 - echo. - echo.Testing of coverage in the sources finished, look at the ^ -results in %BUILDDIR%/coverage/python.txt. - goto end -) - -if "%1" == "xml" ( - %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The XML files are in %BUILDDIR%/xml. - goto end -) - -if "%1" == "pseudoxml" ( - %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. - goto end -) - -:end diff --git a/doc/make.py b/doc/make.py new file mode 100644 index 000000000..26bd1654e --- /dev/null +++ b/doc/make.py @@ -0,0 +1,340 @@ +""" +Build script for documentation +""" +import os +from shutil import which, rmtree +import subprocess +from pathlib import Path +from typing import Union, List + + +# General sphinx state / options +SPHINXOPTS = [] +SPHINXBUILD = "sphinx-build" +SPHINXAUTOBUILD = "sphinx-autobuild" +PAPER_SIZE = None +BUILDDIR = "build" + + +# Internal variables. +PAPER_SIZE_OPTS = {} +PAPER_SIZE_OPTS[None] = [] +PAPER_SIZE_OPTS['a4'] = ['-D', 'latex_paper_size=a4'] +PAPER_SIZE_OPTS['letter'] = ['-D', 'latex_paper_size=letter'] +ALLSPHINXOPTS = ['-d', f'{BUILDDIR}/doctrees', *PAPER_SIZE_OPTS[PAPER_SIZE], *SPHINXOPTS, '.'] +SPHINXAUTOBUILDOPTS = ['--watch', '../arcade'] + +# Important: the i18n builder cannot share the environment and doctrees with the others +# This allows for internationalization / localization of doc. +I18NSPHINXOPTS = [*PAPER_SIZE_OPTS[PAPER_SIZE], *SPHINXOPTS, '.'] + + +# Change dirs into root arcade project folder +os.chdir(Path(__file__).parent.resolve()) + + +# User-friendly check for dependencies and binaries +binaries = ['sphinx-build', 'sphinx-autobuild'] +libraries = ['typer'] +for binary in binaries: + not_found = [binary for binary in binaries if which(binary) is None] + if not_found: + print("Command-line tools not found: " + ', '.join(not_found)) + print("Did you forget to install them with `pip`? See CONTRIBUTING.md file for instructions.") + exit(1) +for library in libraries: + def find(library): + try: + __import__(library) + return True + except: pass + not_found = [library for library in libraries if not find(library)] + if not_found: + print("Python dependencies not found: " + ', '.join(not_found)) + print("Did you forget to install them with `pip`? See CONTRIBUTING.md file for instructions.") + exit(1) + + +import typer +app = typer.Typer() + + +def run(args: Union[str, List[str]]) -> None: + result = subprocess.run(args) + if result.returncode != 0: + exit(result.returncode) + + +@app.command() +def clean(): + """ + Delete built website files. + """ + if os.path.exists(BUILDDIR): + for item in Path(BUILDDIR).glob('*'): + os.remove(item) if os.path.isfile(item) else rmtree(item) + +@app.command() +def html(): + """ + to make standalone HTML files + """ + run([SPHINXBUILD, "-b", "html", *ALLSPHINXOPTS, f"{BUILDDIR}/html"]) + print() + print("Build finished. The HTML pages are in $(BUILDDIR)/html.") + + +@app.command() +def serve(): + """ + Build and serve standalone HTML files, with automatic rebuilds and live reload. + """ + run([SPHINXAUTOBUILD, *SPHINXAUTOBUILDOPTS, '-b', 'html', *ALLSPHINXOPTS, f'{BUILDDIR}/html']) + + +@app.command() +def dirhtml(): + """ + to make HTML files named index.html in directories + """ + run([SPHINXBUILD, "-b", "dirhtml", *ALLSPHINXOPTS, f"{BUILDDIR}/dirhtml"]) + print() + print("Build finished. The HTML pages are in $(BUILDDIR)/dirhtml.") + + +@app.command() +def singlehtml(): + """ + to make a single large HTML file + """ + run([SPHINXBUILD, "-b", "singlehtml", *ALLSPHINXOPTS, f"{BUILDDIR}/singlehtml"]) + print() + print("Build finished. The HTML page is in $(BUILDDIR)/singlehtml.") + + +@app.command() +def pickle(): + """ + to make pickle files + """ + run([SPHINXBUILD, "-b", "pickle", *ALLSPHINXOPTS, f"{BUILDDIR}/pickle"]) + print() + print("Build finished; now you can process the pickle files.") + + +@app.command() +def json(): + """ + to make JSON files + """ + run([SPHINXBUILD, "-b", "json", *ALLSPHINXOPTS, f"{BUILDDIR}/json"]) + print() + print("Build finished; now you can process the JSON files.") + + +@app.command() +def htmlhelp(): + """ + to make HTML files and a HTML help project + """ + run([SPHINXBUILD, "-b", "htmlhelp", *ALLSPHINXOPTS, f"{BUILDDIR}/htmlhelp"]) + print() + print("Build finished; now you can run HTML Help Workshop with the" + + ".hhp project file in $(BUILDDIR)/htmlhelp.") + + +@app.command() +def qthelp(): + """ + to make HTML files and a qthelp project + """ + run([SPHINXBUILD, "-b", "qthelp", *ALLSPHINXOPTS, f"{BUILDDIR}/qthelp"]) + print() + print('Build finished; now you can run "qcollectiongenerator" with the' + + ".qhcp project file in $(BUILDDIR)/qthelp, like this:") + print("# qcollectiongenerator $(BUILDDIR)/qthelp/Arcade.qhcp") + print("To view the help file:") + print("# assistant -collectionFile $(BUILDDIR)/qthelp/Arcade.qhc") + + +@app.command() +def applehelp(): + """ + to make an Apple Help Book + """ + run([SPHINXBUILD, "-b", "applehelp", *ALLSPHINXOPTS, f"{BUILDDIR}/applehelp"]) + print() + print("Build finished. The help book is in $(BUILDDIR)/applehelp.") + print("N.B. You won't be able to view it unless you put it in" + + "~/Library/Documentation/Help or install it in your application" + + "bundle.") + + +@app.command() +def devhelp(): + """ + to make HTML files and a Devhelp project + """ + run([SPHINXBUILD, "-b", "devhelp", *ALLSPHINXOPTS, f"{BUILDDIR}/devhelp"]) + print() + print("Build finished.") + print("To view the help file:") + print("# mkdir -p $$HOME/.local/share/devhelp/Arcade") + print("# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Arcade") + print("# devhelp") + + +@app.command() +def epub(): + """ + to make an epub + """ + run([SPHINXBUILD, "-b", "epub", *ALLSPHINXOPTS, f"{BUILDDIR}/epub"]) + print() + print("Build finished. The epub file is in $(BUILDDIR)/epub.") + + +@app.command() +def latex(): + """ + to make LaTeX files, you can set PAPER_SIZE=a4 or PAPER_SIZE=letter + """ + run([SPHINXBUILD, "-b", "latex", *ALLSPHINXOPTS, f"{BUILDDIR}/latex"]) + print() + print("Build finished; the LaTeX files are in $(BUILDDIR)/latex.") + print("Run \`make' in that directory to run these through (pdf)latex" + + "(use \`make latexpdf' here to do that automatically).") + + +@app.command() +def latexpdf(): + """ + to make LaTeX files and run them through pdflatex + """ + run([SPHINXBUILD, "-b", "latex", *ALLSPHINXOPTS, f"{BUILDDIR}/latex"]) + print("Running LaTeX files through pdflatex...") + run(['make', '-C', f'{BUILDDIR}/latex', 'all-pdf']) + print("pdflatex finished; the PDF files are in $(BUILDDIR)/latex.") + + +@app.command() +def latexpdfja(): + """ + to make LaTeX files and run them through platex/dvipdfmx + """ + run([SPHINXBUILD, "-b", "latex", *ALLSPHINXOPTS, f"{BUILDDIR}/latex"]) + print("Running LaTeX files through platex and dvipdfmx...") + run(['make', '-C', f'{BUILDDIR}/latex', 'all-pdf-ja']) + print("pdflatex finished; the PDF files are in $(BUILDDIR)/latex.") + + +@app.command() +def text(): + """ + to make text files + """ + run([SPHINXBUILD, "-b", "text", *ALLSPHINXOPTS, f"{BUILDDIR}/text"]) + print() + print("Build finished. The text files are in $(BUILDDIR)/text.") + + +@app.command() +def man(): + """ + to make manual pages + """ + run([SPHINXBUILD, "-b", "man", *ALLSPHINXOPTS, f"{BUILDDIR}/man"]) + print() + print("Build finished. The manual pages are in $(BUILDDIR)/man.") + + +@app.command() +def texinfo(): + """ + to make Texinfo files + """ + run([SPHINXBUILD, "-b", "texinfo", *ALLSPHINXOPTS, f"{BUILDDIR}/texinfo"]) + print() + print("Build finished. The Texinfo files are in $(BUILDDIR)/texinfo.") + print("Run \`make' in that directory to run these through makeinfo" + + "(use \`make info' here to do that automatically).") + + +@app.command() +def info(): + """ + to make Texinfo files and run them through makeinfo + """ + run([SPHINXBUILD, "-b", "texinfo", *ALLSPHINXOPTS, f"{BUILDDIR}/texinfo"]) + print("Running Texinfo files through makeinfo...") + run(['make', '-C', f'{BUILDDIR}/texinfo', 'info']) + print("makeinfo finished; the Info files are in $(BUILDDIR)/texinfo.") + + +@app.command() +def gettext(): + """ + to make PO message catalogs + """ + run([SPHINXBUILD, "-b", "gettext", *I18NSPHINXOPTS, f"{BUILDDIR}/locale"]) + print() + print("Build finished. The message catalogs are in $(BUILDDIR)/locale.") + + +@app.command() +def changes(): + """ + to make an overview of all changed/added/deprecated items + """ + run([SPHINXBUILD, "-b", "changes", *ALLSPHINXOPTS, f"{BUILDDIR}/changes"]) + print() + print("The overview file is in $(BUILDDIR)/changes.") + + +@app.command() +def linkcheck(): + """ + to check all external links for integrity + """ + run([SPHINXBUILD, "-b", "linkcheck", *ALLSPHINXOPTS, f"{BUILDDIR}/linkcheck"]) + print() + print("Link check complete; look for any errors in the above output " + + "or in $(BUILDDIR)/linkcheck/output.txt.") + + +@app.command() +def doctest(): + """ + to run all doctests embedded in the documentation (if enabled) + """ + run([SPHINXBUILD, "-b", "doctest", *ALLSPHINXOPTS, f"{BUILDDIR}/doctest"]) + print("Testing of doctests in the sources finished, look at the " + + "results in $(BUILDDIR)/doctest/output.txt.") + + +@app.command() +def coverage(): + """ + to run coverage check of the documentation (if enabled) + """ + run([SPHINXBUILD, "-b", "coverage", *ALLSPHINXOPTS, f"{BUILDDIR}/coverage"]) + print("Testing of coverage in the sources finished, look at the " + + "results in $(BUILDDIR)/coverage/python.txt.") + + +@app.command() +def xml(): + run([SPHINXBUILD, "-b", "xml", *ALLSPHINXOPTS, f"{BUILDDIR}/xml"]) + print() + print("Build finished. The XML files are in $(BUILDDIR)/xml.") + + +@app.command() +def pseudoxml(): + run([SPHINXBUILD, "-b", "pseudoxml", *ALLSPHINXOPTS, f"{BUILDDIR}/pseudoxml"]) + print() + print("Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml.") + + +if __name__ == "__main__": + app() diff --git a/doc/make.sh b/doc/make.sh deleted file mode 100755 index ff7738b14..000000000 --- a/doc/make.sh +++ /dev/null @@ -1 +0,0 @@ -sphinx-build -b html -d build/doctrees . build/html diff --git a/pyproject.toml b/pyproject.toml index 7d30ca640..435b74204 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,7 @@ dev = [ "sphinx-copybutton==0.5.1", # Intentionally kept at 2.3 until this bugfix is published: https://github.com/jdillard/sphinx-sitemap/pull/62 "sphinx-sitemap==2.3.0", + "typer==0.7.0", "wheel", ]