@@ -10,23 +10,9 @@ if "%PYTHON%" == "" (
1010 set PYTHON = py -3
1111)
1212
13- if not defined SPHINXLINT (
14- %PYTHON% -c " import sphinxlint" > nul 2 > nul
15- if errorlevel 1 (
16- echo Installing sphinx-lint with %PYTHON%
17- rem Should have been installed with Sphinx earlier
18- %PYTHON% -m pip install " sphinx-lint<1"
19- if errorlevel 1 exit /B
20- )
21- set SPHINXLINT = %PYTHON% -m sphinxlint
22- )
23-
2413set BUILDDIR = _build
25- set SPHINXOPTS = -W --keep-going --nitpicky
26- set ALLSPHINXOPTS = --doctree-dir %BUILDDIR% /doctrees %SPHINXOPTS% .
27- if NOT " %PAPER% " == " " (
28- set ALLSPHINXOPTS = -D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
29- )
14+ set SPHINXOPTS = --fail-on-warning --keep-going
15+ set _ALL_SPHINX_OPTS = %SPHINXOPTS%
3016
3117if " %1 " == " check" goto check
3218
@@ -60,6 +46,14 @@ if "%1" == "clean" (
6046 goto end
6147)
6248
49+ if " %1 " == " versions" (
50+ %PYTHON% _tools/generate_release_cycle.py
51+ if errorlevel 1 exit /b 1
52+ echo .
53+ echo Release cycle data generated.
54+ goto end
55+ )
56+
6357rem Targets other than "clean", "check", "help", or "" need the
6458rem Sphinx build command, which the user may define via SPHINXBUILD.
6559
@@ -75,157 +69,37 @@ if not defined SPHINXBUILD (
7569 set SPHINXBUILD = venv\Scripts\sphinx-build
7670)
7771
78- if " %1 " == " html" (
79- %SPHINXBUILD% --builder html %ALLSPHINXOPTS% %BUILDDIR% /html
80- if errorlevel 1 exit /b 1
81- echo .
82- echo .Build finished. The HTML pages are in %BUILDDIR% /html.
83- goto end
84- )
85-
8672if " %1 " == " htmlview" (
87- cmd /C %this% html
88-
89- if EXIST " %BUILDDIR% \html\index.html" (
90- echo .Opening " %BUILDDIR% \html\index.html" in the default web browser...
91- start " " " %BUILDDIR% \html\index.html"
92- )
93-
94- goto end
95- )
96-
97- if " %1 " == " dirhtml" (
98- %SPHINXBUILD% --builder dirhtml %ALLSPHINXOPTS% %BUILDDIR% /dirhtml
99- if errorlevel 1 exit /b 1
100- echo .
101- echo .Build finished. The HTML pages are in %BUILDDIR% /dirhtml.
102- goto end
103- )
104-
105- if " %1 " == " singlehtml" (
106- %SPHINXBUILD% --builder singlehtml %ALLSPHINXOPTS% %BUILDDIR% /singlehtml
107- if errorlevel 1 exit /b 1
108- echo .
109- echo .Build finished. The HTML pages are in %BUILDDIR% /singlehtml.
110- goto end
111- )
112-
113- if " %1 " == " pickle" (
114- %SPHINXBUILD% --builder pickle %ALLSPHINXOPTS% %BUILDDIR% /pickle
115- if errorlevel 1 exit /b 1
116- echo .
117- echo .Build finished; now you can process the pickle files.
118- goto end
119- )
120-
121- if " %1 " == " json" (
122- %SPHINXBUILD% --builder json %ALLSPHINXOPTS% %BUILDDIR% /json
123- if errorlevel 1 exit /b 1
124- echo .
125- echo .Build finished; now you can process the JSON files.
126- goto end
127- )
128-
129- if " %1 " == " htmlhelp" (
130- %SPHINXBUILD% --builder htmlhelp %ALLSPHINXOPTS% %BUILDDIR% /htmlhelp
131- if errorlevel 1 exit /b 1
132- echo .
133- echo .Build finished; now you can run HTML Help Workshop with the ^
134- .hhp project file in %BUILDDIR% /htmlhelp.
135- goto end
136- )
137-
138- if " %1 " == " qthelp" (
139- %SPHINXBUILD% --builder qthelp %ALLSPHINXOPTS% %BUILDDIR% /qthelp
140- if errorlevel 1 exit /b 1
141- echo .
142- echo .Build finished; now you can run " qcollectiongenerator" with the ^
143- .qhcp project file in %BUILDDIR% /qthelp, like this:
144- echo .^ > qcollectiongenerator %BUILDDIR% \qthelp\PythonDevelopersGuide.qhcp
145- echo .To view the help file:
146- echo .^ > assistant -collectionFile %BUILDDIR% \qthelp\PythonDevelopersGuide.ghc
147- goto end
148- )
149-
150- if " %1 " == " devhelp" (
151- %SPHINXBUILD% --builder devhelp %ALLSPHINXOPTS% %BUILDDIR% /devhelp
152- if errorlevel 1 exit /b 1
153- echo .
154- echo .Build finished.
155- goto end
156- )
157-
158- if " %1 " == " epub" (
159- %SPHINXBUILD% --builder epub %ALLSPHINXOPTS% %BUILDDIR% /epub
160- if errorlevel 1 exit /b 1
161- echo .
162- echo .Build finished. The epub file is in %BUILDDIR% /epub.
163- goto end
164- )
165-
166- if " %1 " == " latex" (
167- %SPHINXBUILD% --builder latex %ALLSPHINXOPTS% %BUILDDIR% /latex
168- if errorlevel 1 exit /b 1
169- echo .
170- echo .Build finished; the LaTeX files are in %BUILDDIR% /latex.
171- goto end
172- )
73+ cmd /C %this% html
17374
174- if " %1 " == " text" (
175- %SPHINXBUILD% --builder text %ALLSPHINXOPTS% %BUILDDIR% /text
176- if errorlevel 1 exit /b 1
177- echo .
178- echo .Build finished. The text files are in %BUILDDIR% /text.
179- goto end
180- )
181-
182- if " %1 " == " man" (
183- %SPHINXBUILD% --builder man %ALLSPHINXOPTS% %BUILDDIR% /man
184- if errorlevel 1 exit /b 1
185- echo .
186- echo .Build finished. The manual pages are in %BUILDDIR% /man.
187- goto end
188- )
75+ if EXIST " %BUILDDIR% \html\index.html" (
76+ echo .Opening " %BUILDDIR% \html\index.html" in the default web browser...
77+ start " " " %BUILDDIR% \html\index.html"
78+ )
18979
190- if " %1 " == " changes" (
191- %SPHINXBUILD% --builder changes %ALLSPHINXOPTS% %BUILDDIR% /changes
192- if errorlevel 1 exit /b 1
193- echo .
194- echo .The overview file is in %BUILDDIR% /changes.
19580 goto end
19681)
19782
198- if " %1 " == " linkcheck" (
199- %SPHINXBUILD% --builder linkcheck %ALLSPHINXOPTS% %BUILDDIR% /linkcheck
200- if errorlevel 1 exit /b 1
201- echo .
202- echo .Link check complete; look for any errors in the above output ^
203- or in %BUILDDIR% /linkcheck/output.txt.
204- goto end
205- )
83+ %SPHINXBUILD% -M %1 " ." %BUILDDIR% %_ALL_SPHINX_OPTS%
84+ goto end
20685
207- if " %1 " == " doctest" (
208- %SPHINXBUILD% --builder doctest %ALLSPHINXOPTS% %BUILDDIR% /doctest
209- if errorlevel 1 exit /b 1
210- echo .
211- echo .Testing of doctests in the sources finished, look at the ^
212- results in %BUILDDIR% /doctest/output.txt.
213- goto end
86+ :check
87+ if not defined SPHINXLINT (
88+ rem If it is not defined, we build in a virtual environment
89+ if not exist venv (
90+ echo . Setting up the virtual environment
91+ %PYTHON% -m venv venv
92+ echo . Installing requirements
93+ venv\Scripts\python -m pip install -r requirements.txt
94+ )
95+ set PYTHON = venv\Scripts\python
96+ set SPHINXLINT = %PYTHON% -m sphinxlint
21497)
21598
216- :check
21799rem Ignore the tools and venv dirs and check that the default role is not used.
218100cmd /S /C " %SPHINXLINT% -i tools -i venv --enable default-role"
219101goto end
220102
221- if " %1 " == " versions" (
222- %PYTHON% _tools/generate_release_cycle.py
223- if errorlevel 1 exit /b 1
224- echo .
225- echo Release cycle data generated.
226- goto end
227- )
228-
229103:end
230104popd
231105endlocal
0 commit comments