@@ -6,18 +6,18 @@ pushd %~dp0
66set this = %~n0
77
88call ..\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 (
1312 echo Installing sphinx with %PYTHON%
14- " %PYTHON% " -m pip install sphinx
13+ %PYTHON% -m pip install sphinx
1514 if errorlevel 1 exit /B
1615 )
16+ set SPHINXBUILD = %PYTHON% -c " import sphinx, sys; sys.argv[0] = 'sphinx-build'; sphinx.main()"
1717)
1818
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
2121
2222if " %1 " NEQ " htmlhelp" goto :skiphhcsearch
2323if exist " %HTMLHELP% " goto :skiphhcsearch
@@ -99,7 +99,7 @@ goto end
9999if NOT " %PAPER% " == " " (
100100 set SPHINXOPTS = -D latex_elements.papersize=%PAPER% %SPHINXOPTS%
101101)
102- cmd /C %SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . %BUILDDIR% \%*
102+ cmd /C " %SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . %BUILDDIR% \%* "
103103
104104if " %1 " EQU " htmlhelp" (
105105 cmd /C " %HTMLHELP% " build\htmlhelp\python%DISTVERSION:. =% .hhp
0 commit comments