@@ -26,37 +26,43 @@ set TESTTARGETDIR=
2626
2727
2828:CheckOpts
29+ if " %1 " EQU " -h" goto Help
2930if " %1 " EQU " -c" (set CERTNAME=%~2 ) && shift && shift && goto CheckOpts
31+ if " %1 " EQU " --certificate" (set CERTNAME=%~2 ) && shift && shift && goto CheckOpts
3032if " %1 " EQU " -o" (set OUTDIR=%~2 ) && shift && shift && goto CheckOpts
33+ if " %1 " EQU " --out" (set OUTDIR=%~2 ) && shift && shift && goto CheckOpts
3134if " %1 " EQU " -D" (set SKIPDOC=1) && shift && goto CheckOpts
35+ if " %1 " EQU " --skip-doc" (set SKIPDOC=1) && shift && goto CheckOpts
3236if " %1 " EQU " -B" (set SKIPBUILD=1) && shift && goto CheckOpts
37+ if " %1 " EQU " --skip-build" (set SKIPBUILD=1) && shift && goto CheckOpts
3338if " %1 " EQU " --download" (set DOWNLOAD_URL=%~2 ) && shift && shift && goto CheckOpts
3439if " %1 " EQU " --test" (set TESTTARGETDIR=%~2 ) && shift && shift && goto CheckOpts
3540if " %1 " EQU " -b" (set TARGET=Build) && shift && goto CheckOpts
36- if '%1 ' EQU '-x86' (set BUILDX86=1) && shift && goto CheckOpts
37- if '%1 ' EQU '-x64' (set BUILDX64=1) && shift && goto CheckOpts
41+ if " %1 " EQU " --build" (set TARGET=Build) && shift && goto CheckOpts
42+ if " %1 " EQU " -x86" (set BUILDX86=1) && shift && goto CheckOpts
43+ if " %1 " EQU " -x64" (set BUILDX64=1) && shift && goto CheckOpts
3844
3945if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1)
4046
4147:builddoc
4248if " %SKIPBUILD% " EQU " 1" goto skipdoc
4349if " %SKIPDOC% " EQU " 1" goto skipdoc
4450
51+ if not defined PYTHON where py -q || echo Cannot find py on path and PYTHON is not set. && exit /B 1
52+ if not defined SPHINXBUILD where sphinx-build -q || echo Cannot find sphinx-build on path and SPHINXBUILD is not set. && exit /B 1
4553call " %D% ..\..\doc\make.bat" htmlhelp
4654if errorlevel 1 goto :eof
4755:skipdoc
4856
49- where hg > nul 2 > nul
50- if errorlevel 1 echo Cannot find hg on PATH & exit /B 1
51-
52- where dlltool 2 > nul > " %TEMP% \dlltool.loc"
53- if errorlevel 1 dir " %D% ..\..\externals\dlltool.exe" /s/b > " %TEMP% \dlltool.loc"
54- if errorlevel 1 echo Cannot find binutils on PATH or in externals & exit /B 1
55- set /P DLLTOOL = < " %TEMP% \dlltool.loc"
56- set PATH = %PATH% ;%DLLTOOL:~,-12 %
57- set DLLTOOL =
58- del " %TEMP% \dlltool.loc"
57+ where hg /q || echo Cannot find Mercurial on PATH && exit /B 1
5958
59+ where dlltool /q && goto skipdlltoolsearch
60+ set _DLLTOOL_PATH =
61+ where /R " %D% ..\..\externals" dlltool > " %TEMP% \dlltool.loc" 2 > nul && set /P _DLLTOOL_PATH = < " %TEMP% \dlltool.loc" & del " %TEMP% \dlltool.loc"
62+ if not exist " %_DLLTOOL_PATH% " echo Cannot find binutils on PATH or in external && exit /B 1
63+ for %%f in (%_DLLTOOL_PATH% ) do set PATH = %PATH% ;%%~dpf
64+ set _DLLTOOL_PATH =
65+ :skipdlltoolsearch
6066
6167if defined BUILDX86 (
6268 call :build x86
@@ -94,14 +100,12 @@ if "%1" EQU "x86" (
94100 set RELEASE_URI = %RELEASE_URI_X64%
95101)
96102
97- echo on
98103if exist " %BUILD% en-us" (
99104 echo Deleting %BUILD% en-us
100105 rmdir /q/s " %BUILD% en-us"
101106 if errorlevel 1 exit /B
102107)
103108
104- echo on
105109if exist " %D% obj\Release_%OBJDIR_PLAT% " (
106110 echo Deleting " %D% obj\Release_%OBJDIR_PLAT% "
107111 rmdir /q/s " %D% obj\Release_%OBJDIR_PLAT% "
@@ -138,3 +142,22 @@ if not "%OUTDIR%" EQU "" (
138142 copy /Y " %BUILD% en-us\*.msi" " %OUTDIR% \%OUTDIR_PLAT% "
139143)
140144
145+ exit /B 0
146+
147+ :Help
148+ echo buildrelease.bat [--out DIR] [-x86] [-x64] [--certificate CERTNAME] [--build] [--skip-build]
149+ echo [--skip-doc] [--download DOWNLOAD URL] [--test TARGETDIR] [-h]
150+ echo .
151+ echo --out (-o) Specify an additional output directory for installers
152+ echo -x86 Build x86 installers
153+ echo -x64 Build x64 installers
154+ echo --build (-b) Incrementally build Python rather than rebuilding
155+ echo --skip-build (-B) Do not build Python (just do the installers)
156+ echo --skip-doc (-D) Do not build documentation
157+ echo --download Specify the full download URL for MSIs (should include {2})
158+ echo --test Specify the test directory to run the installer tests
159+ echo -h Display this help information
160+ echo .
161+ echo If no architecture is specified, all architectures will be built.
162+ echo If --test is not specified, the installer tests are not run.
163+ echo .
0 commit comments