bpo-31340: Change to building with MSVC v141 (included with Visual St… · python/cpython@5fcd5e6 (original) (raw)

10 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@ test_script:
14 14 - cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 --fail-env-changed -j0
15 15 environment:
16 16 HOST_PYTHON: C:\Python36\python.exe
17 +image:
18 +- Visual Studio 2017
17 19
18 20 # Only trigger AppVeyor if actual code or its configuration changes
19 21 only_commits:
Original file line number Diff line number Diff line change
@@ -16,8 +16,19 @@ if not defined SPHINXBUILD if defined PYTHON (
16 16 set SPHINXBUILD=%PYTHON% -c "import sphinx, sys; sys.argv[0] = 'sphinx-build'; sphinx.main()"
17 17 )
18 18
19 +if not defined BLURB if defined PYTHON (
20 +%PYTHON% -c "import blurb" > nul 2> nul
21 +if errorlevel 1 (
22 +echo Installing blurb with %PYTHON%
23 +%PYTHON% -m pip install blurb
24 +if errorlevel 1 exit /B
25 + )
26 +set BLURB=%PYTHON% -m blurb
27 +)
28 +
19 29 if not defined PYTHON set PYTHON=py
20 30 if not defined SPHINXBUILD set SPHINXBUILD=sphinx-build
31 +if not defined BLURB set BLURB=blurb
21 32
22 33 if "%1" NEQ "htmlhelp" goto :skiphhcsearch
23 34 if exist "%HTMLHELP%" goto :skiphhcsearch
@@ -96,6 +107,19 @@ echo.be passed by setting the SPHINXOPTS environment variable.
96 107 goto end
97 108
98 109 :build
110 +if exist ..\Misc\NEWS (
111 +echo.Copying Misc\NEWS to build\NEWS
112 +copy ..\Misc\NEWS build\NEWS > nul
113 +) else if exist ..\Misc\NEWS.D (
114 +if defined BLURB (
115 +echo.Merging Misc/NEWS with %BLURB%
116 +%BLURB% merge -f build\NEWS
117 + ) else (
118 +echo.No Misc/NEWS file and Blurb is not available.
119 +exit /B 1
120 + )
121 +)
122 +
99 123 if NOT "%PAPER%" == "" (
100 124 set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS%
101 125 )
Original file line number Diff line number Diff line change
@@ -318,26 +318,30 @@ def get_exe_bytes(self):
318 318 # string compares seem wrong, but are what sysconfig.py itself uses
319 319 if self.target_version and self.target_version < cur_version:
320 320 if self.target_version < "2.4":
321 -bv = 6.0
321 +bv = '6.0'
322 322 elif self.target_version == "2.4":
323 -bv = 7.1
323 +bv = '7.1'
324 324 elif self.target_version == "2.5":
325 -bv = 8.0
325 +bv = '8.0'
326 326 elif self.target_version <= "3.2":
327 -bv = 9.0
327 +bv = '9.0'
328 328 elif self.target_version <= "3.4":
329 -bv = 10.0
329 +bv = '10.0'
330 330 else:
331 -bv = 14.0
331 +bv = '14.0'
332 332 else:
333 333 # for current version - use authoritative check.
334 334 try:
335 335 from msvcrt import CRT_ASSEMBLY_VERSION
336 336 except ImportError:
337 337 # cross-building, so assume the latest version
338 -bv = 14.0
338 +bv = '14.0'
339 339 else:
340 -bv = float('.'.join(CRT_ASSEMBLY_VERSION.split('.', 2)[:2]))
340 +bv = '.'.join(CRT_ASSEMBLY_VERSION.split('.', 2)[:2])
341 +if bv == '14.11':
342 +# v141 and v140 are binary compatible,
343 +# so keep using the 14.0 stub.
344 +bv = '14.0'
341 345
342 346
343 347 # wininst-x.y.exe is in the same directory as this file
@@ -353,7 +357,7 @@ def get_exe_bytes(self):
353 357 else:
354 358 sfix = ''
355 359
356 -filename = os.path.join(directory, "wininst-%.1f%s.exe" % (bv, sfix))
360 +filename = os.path.join(directory, "wininst-%s%s.exe" % (bv, sfix))
357 361 f = open(filename, "rb")
358 362 try:
359 363 return f.read()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 +Change to building with MSVC v141 (included with Visual Studio 2017)
Original file line number Diff line number Diff line change
@@ -147,8 +147,24 @@ foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses
147 147 Targets="CleanAll" />
148 148 </Target>
149 149
150 + <Target Name="CopyPGCFiles" BeforeTargets="PrepareForBuild" Condition="$(Configuration) == 'PGUpdate'">
151 + <ItemGroup>
152 + <_PGCFiles Include="$(OutDir)instrumented\$(TargetName)!*.pgc" />
153 + <_PGDFile Include="$(OutDir)instrumented\$(TargetName).pgd" />
154 + <_CopyFiles Include="@(_PGCFiles);@(_PGDFile)" Condition="Exists(%(FullPath))" />
155 + </ItemGroup>
156 + <Delete Files="@(_CopyFiles->'$(OutDir)%(Filename)%(Extension)')" />
157 + <Error Text="PGO run did not succeed (no $(TargetName)!*.pgc files) and there is no data to merge"
158 +Condition="$(RequirePGCFiles) == 'true' and @(_PGCFiles) == ''" />
159 + <Copy SourceFiles="@(_CopyFiles)"
160 +DestinationFolder="$(OutDir)"
161 +UseHardLinksIfPossible="true"
162 +OverwriteReadOnlyFiles="true" />
163 + </Target>
164 +
150 165 <PropertyGroup>
151 - <SdkBinPath Condition="'$(SdkBinPath)' == '' or !Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)\bin\x86</SdkBinPath>
166 + <SdkBinPath Condition="'$(SdkBinPath)' == '' or !Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)\bin\$(DefaultWindowsSDKVersion)\x86</SdkBinPath>
167 + <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)\bin\x86</SdkBinPath>
152 168 <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86</SdkBinPath>
153 169 <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86</SdkBinPath>
154 170 <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\</SdkBinPath>
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
10 10
11 11 We set BasePlatformToolset for ICC's benefit, it's otherwise ignored.
12 12 -->
13 + <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '15.0' or '$(VisualStudioVersion)' == '15.0')">v141</BasePlatformToolset>
13 14 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</BasePlatformToolset>
14 15 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</BasePlatformToolset>
15 16 <BasePlatformToolset Condition="'$(BasePlatformToolset)' == '' and '$(VCTargetsPath11)' != ''">v110</BasePlatformToolset>
@@ -39,6 +40,7 @@
39 40 <BuildPath Condition="'$(ArchName)' == 'amd64'">$(BuildPath64)</BuildPath>
40 41 <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCBuild\$(ArchName)\</BuildPath>
41 42 <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
43 + <BuildPath Condition="$(Configuration) == 'PGInstrument'">$(BuildPath)instrumented\</BuildPath>
42 44
43 45
44 46 <ExternalsDir>$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`))</ExternalsDir>
Original file line number Diff line number Diff line change
@@ -96,6 +96,7 @@ set PYTHONPATH=$(PySourcePath)Lib
96 96 <PropertyGroup>
97 97 <_PGOPath Condition="$(Configuration) == 'PGInstrument' and (Platform)==′Win32′" @setPATH=(Platform) == 'Win32'"&gt;@set PATH=%PATH%%3B(Platform)==Win32"@setPATH=(VCInstallDir)bin</_PGOPath>
98 98 <_PGOPath Condition="$(Configuration) == 'PGInstrument' and (Platform)==′x64′" @setPATH=(Platform) == 'x64'"&gt;@set PATH=%PATH%%3B(Platform)==x64"@setPATH=(VCInstallDir)bin\amd64</_PGOPath>
99 + <_PGOPath Condition="$(Configuration) == 'PGInstrument' and (VCPGORunTimeDir)!=′′" @setPATH=(VC_PGO_RunTime_Dir) != ''"&gt;@set PATH=%PATH%%3B(VCPGORunTimeDir)!=′′"@setPATH=(VC_PGO_RunTime_Dir)</_PGOPath>
99 100 <_Content>@rem This script invokes the most recently built Python with all arguments
100 101 @rem passed through to the interpreter. This file is generated by the
101 102 @rem build process and any changes *will* be thrown away by the next
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@
49 49 </ImportGroup>
50 50 <PropertyGroup>
51 51 <KillPython>true</KillPython>
52 + <RequirePGCFiles>true</RequirePGCFiles>
52 53 </PropertyGroup>
53 54 <ImportGroup Label="PropertySheets">
54 55 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
@@ -429,7 +430,7 @@
429 430 </ClCompile>
430 431 </ItemGroup>
431 432 </Target>
432 - <Target Name="_WarnAboutToolset" BeforeTargets="PrepareForBuild" Condition="$(PlatformToolset) != 'v140'">
433 + <Target Name="_WarnAboutToolset" BeforeTargets="PrepareForBuild" Condition="$(PlatformToolset) != 'v140' and $(PlatformToolset) != 'v141'">
433 434 <Warning Text="Toolset $(PlatformToolset) is not used for official builds. Your build may have errors or incompatibilities." />
434 435 </Target>
435 436 </Project>
Original file line number Diff line number Diff line change
@@ -39,6 +39,28 @@
39 39 Overwrite="true"
40 40 Lines="@(_LicenseFiles->'%(Content)')" />
41 41 </Target>
42 -
42 +
43 + <Target Name="_CopyMiscNews" AfterTargets="PrepareForBuild" Condition="Exists('$(PySourcePath)Misc\NEWS')">
44 + <Copy SourceFiles="$(PySourcePath)Misc\NEWS" DestinationFiles="$(BuildPath)NEWS.txt" />
45 + </Target>
46 +
47 + <Target Name="_MergeMiscNewsWithBlurb" AfterTargets="PrepareForBuild" Condition="$(Blurb) != '' and !Exists('$(PySourcePath)Misc\NEWS')">
48 + <Exec Command="$(Blurb) merge -f "$(BuildPath)NEWS.txt"" WorkingDirectory="$(PCBuild)" />
49 + </Target>
50 +
51 + <Target Name="_MergeMiscNewsWithPython" AfterTargets="PrepareForBuild" Condition="$(Blurb) == '' and !Exists('$(PySourcePath)Misc\NEWS')">
52 + <ItemGroup>
53 + <HostPython Include="$(ExternalsDir)python*\tools\python.exe" />
54 + <HostPython Include="@(HostPython)" Condition="Exists(%(FullPath))" />
55 + <HostPython Include="py" Condition="@(HostPython) == ''" />
56 + </ItemGroup>
57 + <PropertyGroup>
58 + <HostPython>@(HostPython)</HostPython>
59 + <HostPython Condition="$(HostPython.Contains(';'))">$(HostPython.Remove($(HostPython.IndexOf(';'))))</HostPython>
60 + </PropertyGroup>
61 + <Exec Command=""$(HostPython)" -m pip install -U blurb" WorkingDirectory="$(PCBuild)" />
62 + <Exec Command=""$(HostPython)" -m blurb merge -f "$(BuildPath)NEWS.txt"" WorkingDirectory="$(PCBuild)" />
63 + </Target>
64 +
43 65 <Import Project="..\msi.targets" />
44 66 </Project>
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
6 6 <File Name="LICENSE.txt" Source="LICENSE" KeyPath="yes" />
7 7 </Component>
8 8 <Component Id="NEWS.txt" Directory="InstallDirectory" Guid="*">
9 - <File Name="NEWS.txt" Source="!(bindpath.src)Misc\NEWS" KeyPath="yes" />
9 + <File Name="NEWS.txt" KeyPath="yes" />
10 10 </Component>
11 11 </ComponentGroup>
12 12 </Fragment>