Sergei Trofimov | 4e6afe9 | 2015-10-09 09:30:04 +0100 | [diff] [blame] | 1 | @ECHO OFF
|
| 2 |
|
| 3 | REM Command file for Sphinx documentation
|
| 4 |
|
| 5 | if "%SPHINXBUILD%" == "" (
|
| 6 | set SPHINXBUILD=sphinx-build
|
| 7 | )
|
| 8 | set BUILDDIR=_build
|
| 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
|
| 10 | set I18NSPHINXOPTS=%SPHINXOPTS% .
|
| 11 | if NOT "%PAPER%" == "" (
|
| 12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
| 13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
| 14 | )
|
| 15 |
|
| 16 | if "%1" == "" goto help
|
| 17 |
|
| 18 | if "%1" == "help" (
|
| 19 | :help
|
| 20 | echo.Please use `make ^<target^>` where ^<target^> is one of
|
| 21 | echo. html to make standalone HTML files
|
| 22 | echo. dirhtml to make HTML files named index.html in directories
|
| 23 | echo. singlehtml to make a single large HTML file
|
| 24 | echo. pickle to make pickle files
|
| 25 | echo. json to make JSON files
|
| 26 | echo. htmlhelp to make HTML files and a HTML help project
|
| 27 | echo. qthelp to make HTML files and a qthelp project
|
| 28 | echo. devhelp to make HTML files and a Devhelp project
|
| 29 | echo. epub to make an epub
|
| 30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
| 31 | echo. text to make text files
|
| 32 | echo. man to make manual pages
|
| 33 | echo. texinfo to make Texinfo files
|
| 34 | echo. gettext to make PO message catalogs
|
| 35 | echo. changes to make an overview over all changed/added/deprecated items
|
| 36 | echo. xml to make Docutils-native XML files
|
| 37 | echo. pseudoxml to make pseudoxml-XML files for display purposes
|
| 38 | echo. linkcheck to check all external links for integrity
|
| 39 | echo. doctest to run all doctests embedded in the documentation if enabled
|
| 40 | echo. coverage to run coverage check of the documentation if enabled
|
| 41 | goto end
|
| 42 | )
|
| 43 |
|
| 44 | if "%1" == "clean" (
|
| 45 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
| 46 | del /q /s %BUILDDIR%\*
|
| 47 | goto end
|
| 48 | )
|
| 49 |
|
| 50 |
|
| 51 | REM Check if sphinx-build is available and fallback to Python version if any
|
| 52 | %SPHINXBUILD% 2> nul
|
| 53 | if errorlevel 9009 goto sphinx_python
|
| 54 | goto sphinx_ok
|
| 55 |
|
| 56 | :sphinx_python
|
| 57 |
|
| 58 | set SPHINXBUILD=python -m sphinx.__init__
|
| 59 | %SPHINXBUILD% 2> nul
|
| 60 | if errorlevel 9009 (
|
| 61 | echo.
|
| 62 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
| 63 | echo.installed, then set the SPHINXBUILD environment variable to point
|
| 64 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
| 65 | echo.may add the Sphinx directory to PATH.
|
| 66 | echo.
|
| 67 | echo.If you don't have Sphinx installed, grab it from
|
| 68 | echo.http://sphinx-doc.org/
|
| 69 | exit /b 1
|
| 70 | )
|
| 71 |
|
| 72 | :sphinx_ok
|
| 73 |
|
| 74 |
|
| 75 | if "%1" == "html" (
|
| 76 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
| 77 | if errorlevel 1 exit /b 1
|
| 78 | echo.
|
| 79 | echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
| 80 | goto end
|
| 81 | )
|
| 82 |
|
| 83 | if "%1" == "dirhtml" (
|
| 84 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
| 85 | if errorlevel 1 exit /b 1
|
| 86 | echo.
|
| 87 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
| 88 | goto end
|
| 89 | )
|
| 90 |
|
| 91 | if "%1" == "singlehtml" (
|
| 92 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
| 93 | if errorlevel 1 exit /b 1
|
| 94 | echo.
|
| 95 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
| 96 | goto end
|
| 97 | )
|
| 98 |
|
| 99 | if "%1" == "pickle" (
|
| 100 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
| 101 | if errorlevel 1 exit /b 1
|
| 102 | echo.
|
| 103 | echo.Build finished; now you can process the pickle files.
|
| 104 | goto end
|
| 105 | )
|
| 106 |
|
| 107 | if "%1" == "json" (
|
| 108 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
| 109 | if errorlevel 1 exit /b 1
|
| 110 | echo.
|
| 111 | echo.Build finished; now you can process the JSON files.
|
| 112 | goto end
|
| 113 | )
|
| 114 |
|
| 115 | if "%1" == "htmlhelp" (
|
| 116 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
| 117 | if errorlevel 1 exit /b 1
|
| 118 | echo.
|
| 119 | echo.Build finished; now you can run HTML Help Workshop with the ^
|
| 120 | .hhp project file in %BUILDDIR%/htmlhelp.
|
| 121 | goto end
|
| 122 | )
|
| 123 |
|
| 124 | if "%1" == "qthelp" (
|
| 125 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
| 126 | if errorlevel 1 exit /b 1
|
| 127 | echo.
|
| 128 | echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
| 129 | .qhcp project file in %BUILDDIR%/qthelp, like this:
|
| 130 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\devlib.qhcp
|
| 131 | echo.To view the help file:
|
| 132 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\devlib.ghc
|
| 133 | goto end
|
| 134 | )
|
| 135 |
|
| 136 | if "%1" == "devhelp" (
|
| 137 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
| 138 | if errorlevel 1 exit /b 1
|
| 139 | echo.
|
| 140 | echo.Build finished.
|
| 141 | goto end
|
| 142 | )
|
| 143 |
|
| 144 | if "%1" == "epub" (
|
| 145 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
| 146 | if errorlevel 1 exit /b 1
|
| 147 | echo.
|
| 148 | echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
| 149 | goto end
|
| 150 | )
|
| 151 |
|
| 152 | if "%1" == "latex" (
|
| 153 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
| 154 | if errorlevel 1 exit /b 1
|
| 155 | echo.
|
| 156 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
| 157 | goto end
|
| 158 | )
|
| 159 |
|
| 160 | if "%1" == "latexpdf" (
|
| 161 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
| 162 | cd %BUILDDIR%/latex
|
| 163 | make all-pdf
|
| 164 | cd %~dp0
|
| 165 | echo.
|
| 166 | echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
| 167 | goto end
|
| 168 | )
|
| 169 |
|
| 170 | if "%1" == "latexpdfja" (
|
| 171 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
| 172 | cd %BUILDDIR%/latex
|
| 173 | make all-pdf-ja
|
| 174 | cd %~dp0
|
| 175 | echo.
|
| 176 | echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
| 177 | goto end
|
| 178 | )
|
| 179 |
|
| 180 | if "%1" == "text" (
|
| 181 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
| 182 | if errorlevel 1 exit /b 1
|
| 183 | echo.
|
| 184 | echo.Build finished. The text files are in %BUILDDIR%/text.
|
| 185 | goto end
|
| 186 | )
|
| 187 |
|
| 188 | if "%1" == "man" (
|
| 189 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
| 190 | if errorlevel 1 exit /b 1
|
| 191 | echo.
|
| 192 | echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
| 193 | goto end
|
| 194 | )
|
| 195 |
|
| 196 | if "%1" == "texinfo" (
|
| 197 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
| 198 | if errorlevel 1 exit /b 1
|
| 199 | echo.
|
| 200 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
| 201 | goto end
|
| 202 | )
|
| 203 |
|
| 204 | if "%1" == "gettext" (
|
| 205 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
| 206 | if errorlevel 1 exit /b 1
|
| 207 | echo.
|
| 208 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
| 209 | goto end
|
| 210 | )
|
| 211 |
|
| 212 | if "%1" == "changes" (
|
| 213 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
| 214 | if errorlevel 1 exit /b 1
|
| 215 | echo.
|
| 216 | echo.The overview file is in %BUILDDIR%/changes.
|
| 217 | goto end
|
| 218 | )
|
| 219 |
|
| 220 | if "%1" == "linkcheck" (
|
| 221 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
| 222 | if errorlevel 1 exit /b 1
|
| 223 | echo.
|
| 224 | echo.Link check complete; look for any errors in the above output ^
|
| 225 | or in %BUILDDIR%/linkcheck/output.txt.
|
| 226 | goto end
|
| 227 | )
|
| 228 |
|
| 229 | if "%1" == "doctest" (
|
| 230 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
| 231 | if errorlevel 1 exit /b 1
|
| 232 | echo.
|
| 233 | echo.Testing of doctests in the sources finished, look at the ^
|
| 234 | results in %BUILDDIR%/doctest/output.txt.
|
| 235 | goto end
|
| 236 | )
|
| 237 |
|
| 238 | if "%1" == "coverage" (
|
| 239 | %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
|
| 240 | if errorlevel 1 exit /b 1
|
| 241 | echo.
|
| 242 | echo.Testing of coverage in the sources finished, look at the ^
|
| 243 | results in %BUILDDIR%/coverage/python.txt.
|
| 244 | goto end
|
| 245 | )
|
| 246 |
|
| 247 | if "%1" == "xml" (
|
| 248 | %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
|
| 249 | if errorlevel 1 exit /b 1
|
| 250 | echo.
|
| 251 | echo.Build finished. The XML files are in %BUILDDIR%/xml.
|
| 252 | goto end
|
| 253 | )
|
| 254 |
|
| 255 | if "%1" == "pseudoxml" (
|
| 256 | %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
|
| 257 | if errorlevel 1 exit /b 1
|
| 258 | echo.
|
| 259 | echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
|
| 260 | goto end
|
| 261 | )
|
| 262 |
|
| 263 | :end
|