From 2084b30e540d88b9fc752c5bdcc2f24334af4f2b Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 5 Oct 2017 13:35:36 -0700 Subject: [PATCH] bpo-31523: Reliability improvements to the Windows build files (#3900) --- PCbuild/pyproject.props | 2 +- Tools/msi/msi.props | 2 +- Tools/msi/purge.py | 4 ++-- Tools/msi/uploadrelease.bat | 40 ++++++++++++++++++++++++++++++------ Tools/msi/uploadrelease.proj | 35 ++++++++++++++++--------------- 5 files changed, 56 insertions(+), 27 deletions(-) diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index aed8f34583..42ead00d5a 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -6,7 +6,7 @@ $(BuildPath) $(OutDir)\ $(MSBuildThisFileDirectory)obj\ - $(Py_IntDir)\$(ArchName)_$(Configuration)\$(ProjectName)\ + $(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\$(ProjectName)\ $(ProjectName) $(TargetName)$(PyDebugExt) false diff --git a/Tools/msi/msi.props b/Tools/msi/msi.props index 24a90bd8cb..0318f7aa8e 100644 --- a/Tools/msi/msi.props +++ b/Tools/msi/msi.props @@ -48,7 +48,7 @@ - $(Py_IntDir)\$(Configuration)_$(Platform)_Setup\$(OutputName) + $(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\msi_$(OutputName) $(IntermediateOutputPath)_$(OutputSuffix) $(BuildPath) $(OutputPath)\ diff --git a/Tools/msi/purge.py b/Tools/msi/purge.py index 76dbc49ae8..24fdae2438 100644 --- a/Tools/msi/purge.py +++ b/Tools/msi/purge.py @@ -25,7 +25,7 @@ except LookupError: sys.exit(1) URL = "https://www.python.org/ftp/python/{}/".format(m.group(1)) - +REL = m.group(2) or '' FILES = [ "core.msi", @@ -64,7 +64,7 @@ PATHS = [ "python-{}-webinstall.exe".format(m.group(0)), "python-{}-amd64.exe".format(m.group(0)), "python-{}-amd64-webinstall.exe".format(m.group(0)), -] + ["win32{}/{}".format(m.group(2), f) for f in FILES] + ["amd64{}/{}".format(m.group(2), f) for f in FILES] +] + ["win32{}/{}".format(REL, f) for f in FILES] + ["amd64{}/{}".format(REL, f) for f in FILES] print('Purged:') for n in PATHS: diff --git a/Tools/msi/uploadrelease.bat b/Tools/msi/uploadrelease.bat index 4902b6cf3f..3ae5dbc61b 100644 --- a/Tools/msi/uploadrelease.bat +++ b/Tools/msi/uploadrelease.bat @@ -8,8 +8,9 @@ set HOST= set USER= set TARGET= set DRYRUN=false +set NOUPLOAD= set NOGPG= -set PURGE_OPTION=/p:Purge=true +set NOPURGE= set NOTEST= :CheckOpts @@ -21,8 +22,9 @@ if "%1" EQU "--user" (set USER=%~2) && shift && shift && goto CheckOpts if "%1" EQU "-t" (set TARGET=%~2) && shift && shift && goto CheckOpts if "%1" EQU "--target" (set TARGET=%~2) && shift && shift && goto CheckOpts if "%1" EQU "--dry-run" (set DRYRUN=true) && shift && goto CheckOpts +if "%1" EQU "--skip-upload" (set NOUPLOAD=true) && shift && goto CheckOpts if "%1" EQU "--skip-gpg" (set NOGPG=true) && shift && goto CheckOpts -if "%1" EQU "--skip-purge" (set PURGE_OPTION=) && shift && goto CheckOpts +if "%1" EQU "--skip-purge" (set NOPURGE=true) && shift && goto CheckOpts if "%1" EQU "--skip-test" (set NOTEST=true) && shift && goto CheckOpts if "%1" EQU "-T" (set NOTEST=true) && shift && goto CheckOpts if "%1" NEQ "" echo Unexpected argument "%1" & exit /B 1 @@ -52,17 +54,43 @@ if defined NOGPG ( call "%PCBUILD%find_msbuild.bat" %MSBUILD% if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) pushd "%D%" -%MSBUILD% /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x86 %PURGE_OPTION% -%MSBUILD% /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x64 /p:IncludeDoc=false %PURGE_OPTION% +if not defined NOUPLOAD ( + %MSBUILD% /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x86 + if errorlevel 1 goto :failed + %MSBUILD% /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x64 /p:IncludeDoc=false + if errorlevel 1 goto :failed +) +if not defined NOPURGE ( + %MSBUILD% /v:m /nologo uploadrelease.proj /t:Purge +) if not defined NOTEST ( - %MSBUILD% /v:m /nologo uploadrelease.proj /t:Test /p:Platform=x86 - %MSBUILD% /v:m /nologo uploadrelease.proj /t:Test /p:Platform=x64 + call :test x86 + if errorlevel 1 goto :failed + call :test x64 + if errorlevel 1 goto :failed ) %MSBUILD% /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x86 +if errorlevel 1 goto :failed %MSBUILD% /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x64 /p:IncludeDoc=false +if errorlevel 1 goto :failed + popd exit /B 0 +:test +%MSBUILD% /v:m /nologo uploadrelease.proj /t:Test /p:Platform=%1 +if errorlevel 1 ( + echo Test failed - purging and retrying + %MSBUILD% /v:m /nologo uploadrelease.proj /t:Purge + if errorlevel 1 exit /B + %MSBUILD% /v:m /nologo uploadrelease.proj /t:Test /p:Platform=%1 +) +exit /B + +:failed +popd +exit /B + :Help echo uploadrelease.bat --host HOST --user USERNAME [--target TARGET] [--dry-run] [-h] echo. diff --git a/Tools/msi/uploadrelease.proj b/Tools/msi/uploadrelease.proj index 75840f2f85..881b825e10 100644 --- a/Tools/msi/uploadrelease.proj +++ b/Tools/msi/uploadrelease.proj @@ -10,7 +10,6 @@ true true false - false @@ -43,7 +42,8 @@ - + %(File.CopyTo) @@ -52,23 +52,15 @@ - + + + - - - - - - + + + @@ -82,6 +74,7 @@ echo." /> $(OutputPath)\%(Filename)_layoutlog\%(Filename).log + @@ -95,14 +88,22 @@ echo." /> - + + + + + + + + + -- 2.40.0