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