From 913021eb3d27ed27b39249379ce8a30613e35780 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 4 Sep 2017 13:19:26 -0700 Subject: [PATCH 1/9] Change to building with MSVC v141 (included with Visual Studio 2017) --- Lib/distutils/command/bdist_wininst.py | 22 +++++++++++-------- .../2017-09-04-13-19-05.bpo-31340.MbkzLi.rst | 1 + PCbuild/python.props | 1 + 3 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index d3e1d3af22c0514..6309c3e248c6feb 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -318,26 +318,30 @@ def get_exe_bytes(self): # string compares seem wrong, but are what sysconfig.py itself uses if self.target_version and self.target_version < cur_version: if self.target_version < "2.4": - bv = 6.0 + bv = '6.0' elif self.target_version == "2.4": - bv = 7.1 + bv = '7.1' elif self.target_version == "2.5": - bv = 8.0 + bv = '8.0' elif self.target_version <= "3.2": - bv = 9.0 + bv = '9.0' elif self.target_version <= "3.4": - bv = 10.0 + bv = '10.0' else: - bv = 14.0 + bv = '14.0' else: # for current version - use authoritative check. try: from msvcrt import CRT_ASSEMBLY_VERSION except ImportError: # cross-building, so assume the latest version - bv = 14.0 + bv = '14.0' else: - bv = float('.'.join(CRT_ASSEMBLY_VERSION.split('.', 2)[:2])) + bv = '.'.join(CRT_ASSEMBLY_VERSION.split('.', 2)[:2]) + if bv == '14.11': + # v141 and v140 are binary compatible, + # so keep using the 14.0 stub. + bv = '14.0' # wininst-x.y.exe is in the same directory as this file @@ -353,7 +357,7 @@ def get_exe_bytes(self): else: sfix = '' - filename = os.path.join(directory, "wininst-%.1f%s.exe" % (bv, sfix)) + filename = os.path.join(directory, "wininst-%s%s.exe" % (bv, sfix)) f = open(filename, "rb") try: return f.read() diff --git a/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst b/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst new file mode 100644 index 000000000000000..065596fcc859e49 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst @@ -0,0 +1 @@ +Change to building with MSVC v141 (included with Visual Studio 2017) diff --git a/PCbuild/python.props b/PCbuild/python.props index c81cd94fe40b213..a0c4b462621f7fd 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -10,6 +10,7 @@ We set BasePlatformToolset for ICC's benefit, it's otherwise ignored. --> + v141 v140 v120 v110 From 783a13c3609056d4d5580bc6b0a58b096a7f1132 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 4 Sep 2017 14:41:29 -0700 Subject: [PATCH 2/9] Finds most recent WinSDK tools --- PCbuild/pyproject.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index 6ab9b6533f20411..759b46fb75d5178 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -148,7 +148,8 @@ foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses - $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)\bin\x86 + $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)\bin\$(DefaultWindowsSDKVersion)\x86 + $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)\bin\x86 $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86 $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86 $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\ From 307d08b80b26e5b829604137529b0497263a4858 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 4 Sep 2017 14:50:19 -0700 Subject: [PATCH 3/9] Update warning message to allow v141. --- PCbuild/pythoncore.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 8ebb22e0e2bfca9..cf29cc324e9f7cd 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -429,7 +429,7 @@ - + From aa85e671164789c7f95b3ff57a74dda01153d649 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 4 Sep 2017 15:41:10 -0700 Subject: [PATCH 4/9] Enables running "blurb merge" as part of doc and MSI build. --- Doc/make.bat | 16 ++++++++++++++++ Tools/msi/exe/exe.wixproj | 20 +++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Doc/make.bat b/Doc/make.bat index b03372aade72825..e538297ae3b6089 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -16,8 +16,19 @@ if not defined SPHINXBUILD if defined PYTHON ( set SPHINXBUILD=%PYTHON% -c "import sphinx, sys; sys.argv[0] = 'sphinx-build'; sphinx.main()" ) +if not defined BLURB if defined PYTHON ( + %PYTHON% -c "import blurb" > nul 2> nul + if errorlevel 1 ( + echo Installing blurb with %PYTHON% + %PYTHON% -m pip install blurb + if errorlevel 1 exit /B + ) + set BLURB=%PYTHON% -m blurb +) + if not defined PYTHON set PYTHON=py if not defined SPHINXBUILD set SPHINXBUILD=sphinx-build +if not defined BLURB set BLURB=blurb if "%1" NEQ "htmlhelp" goto :skiphhcsearch if exist "%HTMLHELP%" goto :skiphhcsearch @@ -96,6 +107,11 @@ echo.be passed by setting the SPHINXOPTS environment variable. goto end :build +if defined BLURB ( + echo.Merging Misc/NEWS with %BLURB% + %BLURB% merge -f +) + if NOT "%PAPER%" == "" ( set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS% ) diff --git a/Tools/msi/exe/exe.wixproj b/Tools/msi/exe/exe.wixproj index 50f6f88246044c2..2e18e9b935801a5 100644 --- a/Tools/msi/exe/exe.wixproj +++ b/Tools/msi/exe/exe.wixproj @@ -39,6 +39,24 @@ Overwrite="true" Lines="@(_LicenseFiles->'%(Content)')" /> - + + + + + + + + + + + + + @(HostPython) + $(HostPython.Remove($(HostPython.IndexOf(';')))) + + + + + \ No newline at end of file From b70e354255aa733f2c449e57b199ec248ed8484b Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 4 Sep 2017 15:46:56 -0700 Subject: [PATCH 5/9] Guessing how to make AppVeyor use their VS 2017 image for build. --- .github/appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/appveyor.yml b/.github/appveyor.yml index cb9821ccc651aff..25409c95a34d1fd 100644 --- a/.github/appveyor.yml +++ b/.github/appveyor.yml @@ -12,6 +12,8 @@ test_script: - cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 --fail-env-changed -j0 environment: HOST_PYTHON: C:\Python36\python.exe +image: +- Visual Studio 2017 # Only trigger AppVeyor if actual code or its configuration changes only_commits: From f67368c8ef42ea1bf03ed71fb2c59ab39904e1b5 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 4 Sep 2017 16:05:34 -0700 Subject: [PATCH 6/9] Corrects Misc/NEWS build --- Doc/make.bat | 14 +++++++++++--- Tools/msi/exe/exe.wixproj | 12 ++++++++---- Tools/msi/exe/exe_files.wxs | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Doc/make.bat b/Doc/make.bat index e538297ae3b6089..c43135d75beb835 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -107,9 +107,17 @@ echo.be passed by setting the SPHINXOPTS environment variable. goto end :build -if defined BLURB ( - echo.Merging Misc/NEWS with %BLURB% - %BLURB% merge -f +if exist ..\Misc\NEWS ( + echo.Copying Misc\NEWS to build\NEWS + copy ..\Misc\NEWS build\NEWS > nul +) else if exist ..\Misc\NEWS.D ( + if defined BLURB ( + echo.Merging Misc/NEWS with %BLURB% + %BLURB% merge -f build\NEWS + ) else ( + echo.No Misc/NEWS file and Blurb is not available. + exit /B 1 + ) ) if NOT "%PAPER%" == "" ( diff --git a/Tools/msi/exe/exe.wixproj b/Tools/msi/exe/exe.wixproj index 2e18e9b935801a5..8eaf494c4d4cc6f 100644 --- a/Tools/msi/exe/exe.wixproj +++ b/Tools/msi/exe/exe.wixproj @@ -40,11 +40,15 @@ Lines="@(_LicenseFiles->'%(Content)')" /> - - + + - + + + + + @@ -55,7 +59,7 @@ $(HostPython.Remove($(HostPython.IndexOf(';')))) - + diff --git a/Tools/msi/exe/exe_files.wxs b/Tools/msi/exe/exe_files.wxs index e675c21c8975ef1..394b4de473547f0 100644 --- a/Tools/msi/exe/exe_files.wxs +++ b/Tools/msi/exe/exe_files.wxs @@ -6,7 +6,7 @@ - + From 020ced3c9dfb3307b339512d54f151b5ed35a353 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 5 Sep 2017 10:47:16 -0700 Subject: [PATCH 7/9] Fixes PGO runtime path. --- PCbuild/python.vcxproj | 1 + 1 file changed, 1 insertion(+) diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj index 2786ac2ebf7b6b0..ab9fb05adead999 100644 --- a/PCbuild/python.vcxproj +++ b/PCbuild/python.vcxproj @@ -96,6 +96,7 @@ set PYTHONPATH=$(PySourcePath)Lib <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(Platform) == 'Win32'">@set PATH=%PATH%%3B$(VCInstallDir)bin <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(Platform) == 'x64'">@set PATH=%PATH%%3B$(VCInstallDir)bin\amd64 + <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(VC_PGO_RunTime_Dir) != ''">@set PATH=%PATH%%3B$(VC_PGO_RunTime_Dir) <_Content>@rem This script invokes the most recently built Python with all arguments @rem passed through to the interpreter. This file is generated by the @rem build process and any changes *will* be thrown away by the next From b2dc7b52446769d58b20b44e3f5e01e15d4eb057 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 5 Sep 2017 13:11:55 -0700 Subject: [PATCH 8/9] Validate PGO run has succeeded before updating. --- PCbuild/pythoncore.vcxproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index cf29cc324e9f7cd..116133a9cd672ec 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -432,4 +432,10 @@ + + + <_PGCFiles Include="$(OutDir)$(TargetName)!*.pgc" /> + + + From a1172b33ddbdf682bc86d2605495c14bf351f1ae Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 5 Sep 2017 14:34:27 -0700 Subject: [PATCH 9/9] Fix PGO builds by building instrumented into a separate folder. --- PCbuild/pyproject.props | 15 +++++++++++++++ PCbuild/python.props | 1 + PCbuild/pythoncore.vcxproj | 7 +------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index 759b46fb75d5178..aed8f34583b25ba 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -147,6 +147,21 @@ foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses Targets="CleanAll" /> + + + <_PGCFiles Include="$(OutDir)instrumented\$(TargetName)!*.pgc" /> + <_PGDFile Include="$(OutDir)instrumented\$(TargetName).pgd" /> + <_CopyFiles Include="@(_PGCFiles);@(_PGDFile)" Condition="Exists(%(FullPath))" /> + + + + + + $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)\bin\$(DefaultWindowsSDKVersion)\x86 $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)\bin\x86 diff --git a/PCbuild/python.props b/PCbuild/python.props index a0c4b462621f7fd..c2baebc06c7bf9e 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -40,6 +40,7 @@ $(BuildPath64) $(PySourcePath)PCBuild\$(ArchName)\ $(BuildPath)\ + $(BuildPath)instrumented\ $([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`)) diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 116133a9cd672ec..763540e1736dc5d 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -49,6 +49,7 @@ true + true @@ -432,10 +433,4 @@ - - - <_PGCFiles Include="$(OutDir)$(TargetName)!*.pgc" /> - - -