@@ -6,18 +6,18 @@ pushd %~dp0
6
6
set this = %~n0
7
7
8
8
call ..\PCBuild\find_python.bat %PYTHON%
9
- if " %SPHINXBUILD% " EQU " " if " %PYTHON% " NEQ " " (
10
- set SPHINXBUILD = %PYTHON% \..\Scripts\sphinx-build.exe
11
- rem Cannot use %SPHINXBUILD% in the same block where we set it
12
- if not exist " %PYTHON% \..\Scripts\sphinx-build.exe" (
9
+ if not defined SPHINXBUILD if defined PYTHON (
10
+ %PYTHON% -c " import sphinx" > nul 2 > nul
11
+ if errorlevel 1 (
13
12
echo Installing sphinx with %PYTHON%
14
- " %PYTHON% " -m pip install sphinx
13
+ %PYTHON% -m pip install sphinx
15
14
if errorlevel 1 exit /B
16
15
)
16
+ set SPHINXBUILD = %PYTHON% -c " import sphinx, sys; sys.argv[0] = 'sphinx-build'; sphinx.main()"
17
17
)
18
18
19
- if " %PYTHON% " EQU " " set PYTHON = py
20
- if " %SPHINXBUILD% " EQU " " set SPHINXBUILD = sphinx-build
19
+ if not defined PYTHON set PYTHON = py
20
+ if not defined SPHINXBUILD set SPHINXBUILD = sphinx-build
21
21
22
22
if " %1 " NEQ " htmlhelp" goto :skiphhcsearch
23
23
if exist " %HTMLHELP% " goto :skiphhcsearch
@@ -99,7 +99,7 @@ goto end
99
99
if NOT " %PAPER% " == " " (
100
100
set SPHINXOPTS = -D latex_elements.papersize=%PAPER% %SPHINXOPTS%
101
101
)
102
- cmd /C %SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . %BUILDDIR% \%*
102
+ cmd /C " %SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . %BUILDDIR% \%* "
103
103
104
104
if " %1 " EQU " htmlhelp" (
105
105
cmd /C " %HTMLHELP% " build\htmlhelp\python%DISTVERSION:. =% .hhp
0 commit comments