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