bpo-44479: Regenerate test_frozenmain.h and frozen_hello.h during build on Windows (GH-26984)

This commit is contained in:
Steve Dower 2021-07-05 17:28:00 +01:00 committed by GitHub
parent d17cc1ff9f
commit f3289a5050
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 29 deletions

View file

@ -123,6 +123,11 @@
<IntFile>$(IntDir)importlib_zipimport.g.h</IntFile> <IntFile>$(IntDir)importlib_zipimport.g.h</IntFile>
<OutFile>$(PySourcePath)Python\importlib_zipimport.h</OutFile> <OutFile>$(PySourcePath)Python\importlib_zipimport.h</OutFile>
</None> </None>
<None Include="..\Tools\freeze\flag.py">
<ModName>hello</ModName>
<IntFile>$(IntDir)frozen_hello.g.h</IntFile>
<OutFile>$(PySourcePath)Python\frozen_hello.h</OutFile>
</None>
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
@ -130,11 +135,6 @@
<Target Name="_RebuildImportLib"> <Target Name="_RebuildImportLib">
<Exec Command='"$(TargetPath)" "%(None.ModName)" "%(None.FullPath)" "%(None.IntFile)"' /> <Exec Command='"$(TargetPath)" "%(None.ModName)" "%(None.FullPath)" "%(None.IntFile)"' />
<PropertyGroup>
<_OldContent Condition="Exists($(OutTargetPath))"></_OldContent>
<_NewContent Condition="Exists($(IntTargetPath))">$([System.IO.File]::ReadAllText($(IntTargetPath)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))</_NewContent>
</PropertyGroup>
<Copy SourceFiles="%(None.IntFile)" <Copy SourceFiles="%(None.IntFile)"
DestinationFiles="%(None.OutFile)" DestinationFiles="%(None.OutFile)"
Condition="!Exists(%(None.OutFile)) or (Exists(%(None.IntFile)) and '$([System.IO.File]::ReadAllText(%(None.OutFile)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))' != '$([System.IO.File]::ReadAllText(%(None.IntFile)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))')"> Condition="!Exists(%(None.OutFile)) or (Exists(%(None.IntFile)) and '$([System.IO.File]::ReadAllText(%(None.OutFile)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))' != '$([System.IO.File]::ReadAllText(%(None.IntFile)).Replace(`&#x0D;&#x0A;`, `&#x0A;`))')">
@ -153,9 +153,7 @@
</Target> </Target>
<Target Name="_CleanImportLib" BeforeTargets="CoreClean"> <Target Name="_CleanImportLib" BeforeTargets="CoreClean">
<ItemGroup> <ItemGroup>
<Clean Include="$(IntDir)importlib.g.h" /> <Clean Include="%(None.IntFile)" />
<Clean Include="$(IntDir)importlib_external.g.h" />
<Clean Include="$(IntDir)importlib_zipimport.g.h" />
</ItemGroup> </ItemGroup>
</Target> </Target>
</Project> </Project>

View file

@ -114,7 +114,9 @@
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="regen.targets" />
</ImportGroup> </ImportGroup>
<Target Name="_TriggerPostRegen" AfterTargets="Build" DependsOnTargets="PostBuildRegen" />
<Target Name="ValidateUcrtbase" AfterTargets="AfterBuild" Condition="$(Configuration) != 'PGInstrument' and $(Platform) != 'ARM' and $(Platform) != 'ARM64'"> <Target Name="ValidateUcrtbase" AfterTargets="AfterBuild" Condition="$(Configuration) != 'PGInstrument' and $(Platform) != 'ARM' and $(Platform) != 'ARM64'">
<PropertyGroup> <PropertyGroup>
<UcrtName>ucrtbase</UcrtName> <UcrtName>ucrtbase</UcrtName>
@ -145,23 +147,4 @@ $(_PGOPath)
</PropertyGroup> </PropertyGroup>
<WriteLinesToFile File="$(PySourcePath)python.bat" Lines="$(_Content)" Overwrite="true" Condition="'$(_Content)' != '$(_ExistingContent)'" /> <WriteLinesToFile File="$(PySourcePath)python.bat" Lines="$(_Content)" Overwrite="true" Condition="'$(_Content)' != '$(_ExistingContent)'" />
</Target> </Target>
<Target Name="GenerateLicense" AfterTargets="AfterBuild">
<ItemGroup>
<LicenseFiles Include="$(PySourcePath)LICENSE;
$(PySourcePath)PC\crtlicense.txt;
$(bz2Dir)LICENSE;
$(opensslOutDir)LICENSE;
$(libffiDir)LICENSE;" />
<LicenseFiles Include="$(tcltkDir)tcllicense.terms;
$(tcltkDir)tklicense.terms;
$(tcltkDir)tixlicense.terms" Condition="$(IncludeTkinter)" />
<_LicenseFiles Include="@(LicenseFiles)">
<Content Condition="Exists(%(FullPath))">$([System.IO.File]::ReadAllText(%(FullPath)))</Content>
</_LicenseFiles>
</ItemGroup>
<WriteLinesToFile File="$(OutDir)LICENSE.txt"
Overwrite="true"
Lines="@(_LicenseFiles->'%(Content)')" />
</Target>
</Project> </Project>

View file

@ -73,7 +73,7 @@
</Target> </Target>
<Target Name="_RegenKeywords" Inputs="@(_KeywordSources)" Outputs="@(_KeywordOutputs)"> <Target Name="_RegenKeywords" Inputs="@(_KeywordSources)" Outputs="@(_KeywordOutputs)">
<Message Text="Regenerate @(KeywordOutputs->'%(Filename)%(Extension)',' ')" Importance="high" /> <Message Text="Regenerate @(_KeywordOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
<Exec Command="set PYTHONPATH=Tools\peg_generator%0D%0A$(PythonForBuild) -m pegen.keywordgen Grammar\python.gram Grammar\Tokens Lib\keyword.py" <Exec Command="set PYTHONPATH=Tools\peg_generator%0D%0A$(PythonForBuild) -m pegen.keywordgen Grammar\python.gram Grammar\Tokens Lib\keyword.py"
WorkingDirectory="$(PySourcePath)" /> WorkingDirectory="$(PySourcePath)" />
</Target> </Target>
@ -81,4 +81,36 @@
<Target Name="Regen" DependsOnTargets="_TouchRegenSources;_RegenPegen;_RegenAST_H;_RegenOpcodes;_RegenTokens;_RegenKeywords"> <Target Name="Regen" DependsOnTargets="_TouchRegenSources;_RegenPegen;_RegenAST_H;_RegenOpcodes;_RegenTokens;_RegenKeywords">
<Message Text="Generated sources are up to date" Importance="high" /> <Message Text="Generated sources are up to date" Importance="high" />
</Target> </Target>
<ItemGroup>
<_TestFrozenSources Include="$(PySourcePath)Programs\freeze_test_frozenmain.py;
$(PySourcePath)Programs\test_frozenmain.py;
@(_OpcodeOutputs)" />
<_TestFrozenOutputs Include="$(PySourcePath)Programs\test_frozenmain.h" />
<_LicenseSources Include="$(PySourcePath)LICENSE;
$(PySourcePath)PC\crtlicense.txt;
$(bz2Dir)LICENSE;
$(opensslOutDir)LICENSE;
$(libffiDir)LICENSE;" />
<_LicenseSources Include="$(tcltkDir)tcllicense.terms;
$(tcltkDir)tklicense.terms;
$(tcltkDir)tixlicense.terms" Condition="$(IncludeTkinter)" />
<_LicenseOutputs Include="$(OutDir)LICENSE.txt" />
</ItemGroup>
<Target Name="_RegenLicense" Inputs="@(_LicenseSources)" Outputs="@(_LicenseOutputs)">
<Message Text="Regenerate @(_LicenseOutputs->'%(Filename)%(Extension)', ' ')" Importance="high" />
<ItemGroup>
<_Text Include="@(_LicenseFiles)">
<Content Condition="Exists(%(FullPath))">$([System.IO.File]::ReadAllText(%(FullPath)))</Content>
</_Text>
</ItemGroup>
<WriteLinesToFile File="@(_LicenseOutputs)" Overwrite="true" Lines="@(_Text->'%(Content)')" />
</Target>
<Target Name="PostBuildRegen" DependsOnTargets="_RegenLicense">
<Message Text="Other generated files are up to date" Importance="high" />
</Target>
</Project> </Project>