You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

284 lines
7.3 KiB

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