Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 312cef0

Browse files
committed
Improve Windows release scripts
1 parent 914db0f commit 312cef0

5 files changed

Lines changed: 81 additions & 35 deletions

File tree

Doc/make.bat

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ set this=%~n0
88
if "%SPHINXBUILD%" EQU "" set SPHINXBUILD=sphinx-build
99
if "%PYTHON%" EQU "" set PYTHON=py
1010

11-
if "%HTMLHELP%" EQU "" (
12-
where hhc 2>nul >"%TEMP%\hhc.loc"
13-
if errorlevel 1 dir "..\externals\hhc.exe" /s/b > "%TEMP%\hhc.loc"
14-
if errorlevel 1 echo Cannot find HHC on PATH or in externals & exit /B 1
15-
set /P HTMLHELP= < "%TEMP%\hhc.loc"
16-
del "%TEMP%\hhc.loc"
17-
)
11+
if "%1" NEQ "htmlhelp" goto :skiphhcsearch
12+
if exist "%HTMLHELP%" goto :skiphhcsearch
13+
14+
rem Search for HHC in likely places
15+
set HTMLHELP=
16+
where hhc /q && set HTMLHELP=hhc && goto :skiphhcsearch
17+
where /R ..\externals hhc > "%TEMP%\hhc.loc" 2> nul && set /P HTMLHELP= < "%TEMP%\hhc.loc" & del "%TEMP%\hhc.loc"
18+
if not exist "%HTMLHELP%" where /R "%ProgramFiles(x86)%" hhc > "%TEMP%\hhc.loc" 2> nul && set /P HTMLHELP= < "%TEMP%\hhc.loc" & del "%TEMP%\hhc.loc"
19+
if not exist "%HTMLHELP%" where /R "%ProgramFiles%" hhc > "%TEMP%\hhc.loc" 2> nul && set /P HTMLHELP= < "%TEMP%\hhc.loc" & del "%TEMP%\hhc.loc"
20+
if not exist "%HTMLHELP%" echo Cannot find HHC on PATH or in externals & exit /B 1
21+
:skiphhcsearch
1822

1923
if "%DISTVERSION%" EQU "" for /f "usebackq" %%v in (`%PYTHON% tools/extensions/patchlevel.py`) do set DISTVERSION=%%v
2024

Tools/msi/buildrelease.bat

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,37 +26,43 @@ set TESTTARGETDIR=
2626

2727

2828
:CheckOpts
29+
if "%1" EQU "-h" goto Help
2930
if "%1" EQU "-c" (set CERTNAME=%~2) && shift && shift && goto CheckOpts
31+
if "%1" EQU "--certificate" (set CERTNAME=%~2) && shift && shift && goto CheckOpts
3032
if "%1" EQU "-o" (set OUTDIR=%~2) && shift && shift && goto CheckOpts
33+
if "%1" EQU "--out" (set OUTDIR=%~2) && shift && shift && goto CheckOpts
3134
if "%1" EQU "-D" (set SKIPDOC=1) && shift && goto CheckOpts
35+
if "%1" EQU "--skip-doc" (set SKIPDOC=1) && shift && goto CheckOpts
3236
if "%1" EQU "-B" (set SKIPBUILD=1) && shift && goto CheckOpts
37+
if "%1" EQU "--skip-build" (set SKIPBUILD=1) && shift && goto CheckOpts
3338
if "%1" EQU "--download" (set DOWNLOAD_URL=%~2) && shift && shift && goto CheckOpts
3439
if "%1" EQU "--test" (set TESTTARGETDIR=%~2) && shift && shift && goto CheckOpts
3540
if "%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

3945
if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1)
4046

4147
:builddoc
4248
if "%SKIPBUILD%" EQU "1" goto skipdoc
4349
if "%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
4553
call "%D%..\..\doc\make.bat" htmlhelp
4654
if 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

6167
if 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
98103
if 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
105109
if 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.

Tools/msi/bundle/bundle.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<OutputPath>$(OutputPath)en-us\</OutputPath>
1515
<OutDir>$(OutputPath)</OutDir>
1616

17-
<DownloadUrl Condition="'$(DownloadUrl)' == '' and '$(DownloadUrlBase)' != ''">$(DownloadUrlBase.TrimEnd(`/`))/$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)/$(ArchName)$(ReleaseLevelName)/{2}</DownloadUrl>
18-
<DefineConstants Condition="'$(DownloadUrl)' != ''">$(DefineConstants);DownloadUrl=$(DownloadUrl)</DefineConstants>
17+
<DownloadUrl Condition="'$(DownloadUrl)' == '' and '$(DownloadUrlBase)' != ''">$(DownloadUrlBase.TrimEnd(`/`))/$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)/$(ArchName)$(ReleaseLevelName)/</DownloadUrl>
18+
<DefineConstants Condition="'$(DownloadUrl)' != ''">$(DefineConstants);DownloadUrl=$(DownloadUrl){2}</DefineConstants>
1919
<DefineConstants Condition="'$(DownloadUrl)' == ''">$(DefineConstants);DownloadUrl={2}</DefineConstants>
2020
</PropertyGroup>
2121

Tools/msi/msi.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
MajorVersionNumber=$(MajorVersionNumber);
7070
MinorVersionNumber=$(MinorVersionNumber);
7171
UpgradeMinimumVersion=$(MajorVersionNumber).$(MinorVersionNumber).0.0;
72-
UpgradeMaximumVersion=$(MajorVersionNumber).$(MinorVersionNumber).150.0;
7372
NextMajorVersionNumber=$(MajorVersionNumber).$([msbuild]::Add($(MinorVersionNumber), 1)).0.0;
7473
PyDebugExt=$(PyDebugExt);
7574
</DefineConstants>

Tools/msi/testrelease.bat

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,34 @@ set TESTALLUSER=
1111
set TESTPERUSER=
1212

1313
:CheckOpts
14-
if '%1' EQU '-x86' (set TESTX86=1) && shift && goto CheckOpts
15-
if '%1' EQU '-x64' (set TESTX64=1) && shift && goto CheckOpts
16-
if '%1' EQU '-t' (set TARGETDIR=%~2) && shift && shift && goto CheckOpts
17-
if '%1' EQU '-a' (set TESTALLUSER=1) && shift && goto CheckOpts
18-
if '%1' EQU '-p' (set TESTPERUSER=1) && shift && goto CheckOpts
14+
if "%1" EQU "-h" goto Help
15+
if "%1" EQU "-x86" (set TESTX86=1) && shift && goto CheckOpts
16+
if "%1" EQU "-x64" (set TESTX64=1) && shift && goto CheckOpts
17+
if "%1" EQU "-t" (set TARGETDIR=%~2) && shift && shift && goto CheckOpts
18+
if "%1" EQU "--target" (set TARGETDIR=%~2) && shift && shift && goto CheckOpts
19+
if "%1" EQU "-a" (set TESTALLUSER=1) && shift && goto CheckOpts
20+
if "%1" EQU "--alluser" (set TESTALLUSER=1) && shift && goto CheckOpts
21+
if "%1" EQU "-p" (set TESTPERUSER=1) && shift && goto CheckOpts
22+
if "%1" EQU "--peruser" (set TESTPERUSER=1) && shift && goto CheckOpts
1923

2024
if not defined TESTX86 if not defined TESTX64 (set TESTX86=1) && (set TESTX64=1)
2125
if not defined TESTALLUSER if not defined TESTPERUSER (set TESTALLUSER=1) && (set TESTPERUSER=1)
2226

2327

2428
if defined TESTX86 (
2529
for %%f in ("%PCBUILD%win32\en-us\*.exe") do (
26-
if defined TESTALLUSER call :test "%%~ff" "%TARGETDIR%\%%~nf-alluser" InstallAllUsers=1
27-
if defined TESTPERUSER call :test "%%~ff" "%TARGETDIR%\%%~nf-peruser" InstallAllUsers=0
30+
if defined TESTALLUSER call :test "%%~ff" "%TARGETDIR%\%%~nf-alluser" "InstallAllUsers=1 CompileAll=1"
31+
if errorlevel 1 exit /B
32+
if defined TESTPERUSER call :test "%%~ff" "%TARGETDIR%\%%~nf-peruser" "InstallAllUsers=0 CompileAll=0"
2833
if errorlevel 1 exit /B
2934
)
3035
)
3136

3237
if defined TESTX64 (
3338
for %%f in ("%PCBUILD%amd64\en-us\*.exe") do (
34-
if defined TESTALLUSER call :test "%%~ff" "%TARGETDIR%\%%~nf-alluser" InstallAllUsers=1
35-
if defined TESTPERUSER call :test "%%~ff" "%TARGETDIR%\%%~nf-peruser" InstallAllUsers=0
39+
if defined TESTALLUSER call :test "%%~ff" "%TARGETDIR%\%%~nf-alluser" "InstallAllUsers=1 CompileAll=1"
40+
if errorlevel 1 exit /B
41+
if defined TESTPERUSER call :test "%%~ff" "%TARGETDIR%\%%~nf-peruser" "InstallAllUsers=0 CompileAll=0"
3642
if errorlevel 1 exit /B
3743
)
3844
)
@@ -47,7 +53,7 @@ exit /B 0
4753

4854
@set EXITCODE=0
4955
@echo Installing %1 into %2
50-
"%~1" /passive /log "%~2\install\log.txt" %~3 TargetDir="%~2\Python" Include_debug=1 Include_symbols=1 CompileAll=1
56+
"%~1" /passive /log "%~2\install\log.txt" TargetDir="%~2\Python" Include_debug=1 Include_symbols=1 %~3
5157

5258
@if not errorlevel 1 (
5359
@echo Printing version
@@ -57,7 +63,7 @@ exit /B 0
5763
@echo Installing package
5864
"%~2\Python\python.exe" -m pip install azure > "%~2\pip.txt" 2>&1
5965
@if not errorlevel 1 (
60-
"%~2\Python\python.exe" -m pip uninstall -y azure python-dateutil six > "%~2\pip.txt" 2>&1
66+
"%~2\Python\python.exe" -m pip uninstall -y azure python-dateutil six >> "%~2\pip.txt" 2>&1
6167
)
6268
)
6369
@if not errorlevel 1 (
@@ -78,3 +84,17 @@ exit /B 0
7884

7985
@echo off
8086
exit /B %EXITCODE%
87+
88+
:Help
89+
echo testrelease.bat [--target TARGET] [-x86] [-x64] [--alluser] [--peruser] [-h]
90+
echo.
91+
echo --target (-t) Specify the target directory for installs and logs
92+
echo -x86 Run tests for x86 installers
93+
echo -x64 Run tests for x64 installers
94+
echo --alluser (-a) Run tests for all-user installs (requires Administrator)
95+
echo --peruser (-p) Run tests for per-user installs
96+
echo -h Display this help information
97+
echo.
98+
echo If no test architecture is specified, all architectures will be tested.
99+
echo If no install type is selected, all install types will be tested.
100+
echo.

0 commit comments

Comments
 (0)