1@ECHO OFF
2REM ~ Windows command line make file for Sphinx documentation
3
4SETLOCAL
5
6SET SPHINXOPTS=
7SET SPHINXBUILD=sphinx-build
8SET PAPER=
9SET SRCDIR=source
10SET PYTHON=python
11
12IF "%PAPER%" == "" SET PAPER=a4
13SET ALLSPHINXOPTS=-d build\doctrees -D latex_paper_size=%PAPER% %SPHINXOPTS% %SRCDIR%
14
15FOR %%X IN (%SPHINXBUILD%.exe) DO SET P=%%~$PATH:X
16
17FOR %%L IN (html html_noapi pickle htmlhelp latex changes linkcheck) DO (
18    IF "%1" == "%%L" (
19        IF "%P%" == "" (
20            ECHO.
21            ECHO Error: Sphinx is not available. Please make sure it is correctly installed.
22            GOTO END
23        )
24        MD build\doctrees 2>NUL
25        MD build\%1 || GOTO DIR_EXIST
26        %PYTHON% autogen_config.py && ECHO Created docs for config options
27        %PYTHON% autogen_magics.py && ECHO Created docs for line ^& cell magics
28        %PYTHON% autogen_shortcuts.py && ECHO Created docs for shortcuts
29        IF NOT "%1" == "html_noapi" (
30            %PYTHON% autogen_api.py && ECHO Build API docs finished
31            %SPHINXBUILD% -b %1 %ALLSPHINXOPTS% build\%1
32        ) ELSE (
33            %SPHINXBUILD% -b html %ALLSPHINXOPTS% build\%1
34        )
35        IF NOT ERRORLEVEL 0 GOTO ERROR
36        ECHO.
37        ECHO Build finished. Results are in build\%1.
38        IF "%1" == "pickle" (
39            ECHO Now you can process the pickle files or run
40            ECHO    sphinx-web build\pickle to start the sphinx-web server.
41        )
42        IF "%1" == "htmlhelp" (
43            ECHO Now you can run HTML Help Workshop with the
44            ECHO    .hhp project file in build/htmlhelp.
45        )
46        IF "%1" == "linkcheck" (
47            ECHO Look for any errors in the above output
48            ECHO    or in build\linkcheck\output.rst.
49        )
50        GOTO END
51    )
52)
53
54
55IF "%1" == "clean" (
56    RD /s /q build dist %SRCDIR%\api\generated 2>NUL
57    IF ERRORLEVEL 0 ECHO Build environment cleaned!
58    GOTO END
59)
60
61ECHO.
62ECHO Please use "make [target]" where [target] is one of:
63ECHO.
64ECHO    html        to make standalone HTML files
65ECHO    html_noapi  same as above, without the time consuming API docs
66ECHO    jsapi       to make standalone HTML files for the Javascript API
67ECHO    pickle      to make pickle files (usable by e.g. sphinx-web)
68ECHO    htmlhelp    to make HTML files and a HTML help project
69ECHO    latex       to make LaTeX files, you can set PAPER=a4 or PAPER=letter
70ECHO    changes     to make an overview over all changed/added/deprecated items
71ECHO    linkcheck   to check all external links for integrity
72GOTO END
73
74:DIR_EXIST
75ECHO.
76ECHO Info: Run "make clean" to clean build environment
77
78:ERROR
79ECHO.
80ECHO Error: Build process failed!
81
82:END
83ENDLOCAL