mirror of
https://github.com/python/cpython
synced 2024-09-05 00:05:39 +00:00
bpo-43567: Improved generated code refresh on Windows (GH-25120)
Generated files are now refreshed automatically on regular build, or may be forcibly regenerated by calling `build.bat --regen`.
This commit is contained in:
parent
0fdf11e8e9
commit
7482838190
|
@ -0,0 +1 @@
|
||||||
|
Improved generated code refresh (AST/tokens/opcodes/keywords) on Windows.
|
|
@ -140,10 +140,12 @@
|
||||||
Condition="!Exists(%(None.OutFile)) or (Exists(%(None.IntFile)) and '$([System.IO.File]::ReadAllText(%(None.OutFile)).Replace(`
`, `
`))' != '$([System.IO.File]::ReadAllText(%(None.IntFile)).Replace(`
`, `
`))')">
|
Condition="!Exists(%(None.OutFile)) or (Exists(%(None.IntFile)) and '$([System.IO.File]::ReadAllText(%(None.OutFile)).Replace(`
`, `
`))' != '$([System.IO.File]::ReadAllText(%(None.IntFile)).Replace(`
`, `
`))')">
|
||||||
<Output TaskParameter="CopiedFiles" ItemName="_Updated" />
|
<Output TaskParameter="CopiedFiles" ItemName="_Updated" />
|
||||||
</Copy>
|
</Copy>
|
||||||
|
|
||||||
<Warning Text="@(_Updated->'%(Filename)%(Extension)',', ') updated. You will need to rebuild pythoncore to see the changes.%0D%0A%0D%0AIf you are not developing on Windows but you see this error on a continuous integration build, you need to run 'make regen-all' and commit any changes."
|
<Message Text="Updated files: @(_Updated->'%(Filename)%(Extension)',', ')"
|
||||||
|
Condition="'@(_Updated)' != ''" Importance="high" />
|
||||||
|
<Warning Text="Frozen importlib files were updated. Please rebuild to pick up the changes.%0D%0A%0D%0AIf you are not developing on Windows but you see this error on a continuous integration build, please run 'make regen-all' and commit anything that changes."
|
||||||
Condition="'@(_Updated)' != '' and $(Configuration) == 'Debug'" />
|
Condition="'@(_Updated)' != '' and $(Configuration) == 'Debug'" />
|
||||||
<Error Text="@(_Updated->'%(Filename)%(Extension)',', ') updated. You will need to rebuild pythoncore to see the changes.%0D%0A%0D%0AIf you are not developing on Windows but you see this error on a continuous integration build, you need to run 'make regen-all' and commit any changes."
|
<Error Text="Frozen importlib files were updated. Please rebuild to pick up the changes.%0D%0A%0D%0AIf you are not developing on Windows but you see this error on a continuous integration build, please run 'make regen-all' and commit anything that changes."
|
||||||
Condition="'@(_Updated)' != '' and $(Configuration) == 'Release'" />
|
Condition="'@(_Updated)' != '' and $(Configuration) == 'Release'" />
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="RebuildImportLib" AfterTargets="AfterBuild" Condition="$(Configuration) == 'Debug' or $(Configuration) == 'Release'"
|
<Target Name="RebuildImportLib" AfterTargets="AfterBuild" Condition="$(Configuration) == 'Debug' or $(Configuration) == 'Release'"
|
||||||
|
|
|
@ -34,7 +34,7 @@ echo. automatically by the pythoncore project)
|
||||||
echo. --pgo Build with Profile-Guided Optimization. This flag
|
echo. --pgo Build with Profile-Guided Optimization. This flag
|
||||||
echo. overrides -c and -d
|
echo. overrides -c and -d
|
||||||
echo. --test-marker Enable the test marker within the build.
|
echo. --test-marker Enable the test marker within the build.
|
||||||
echo. --regen Regenerate all opcodes, grammar and tokens
|
echo. --regen Regenerate all opcodes, grammar and tokens.
|
||||||
echo.
|
echo.
|
||||||
echo.Available flags to avoid building certain modules.
|
echo.Available flags to avoid building certain modules.
|
||||||
echo.These flags have no effect if '-e' is not given:
|
echo.These flags have no effect if '-e' is not given:
|
||||||
|
@ -116,8 +116,14 @@ rem Setup the environment
|
||||||
call "%dir%find_msbuild.bat" %MSBUILD%
|
call "%dir%find_msbuild.bat" %MSBUILD%
|
||||||
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
|
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
|
||||||
|
|
||||||
|
call "%dir%find_python.bat" %PYTHON%
|
||||||
|
if ERRORLEVEL 1 (echo Cannot locate python.exe on PATH or as PYTHON variable & exit /b 3)
|
||||||
|
set PythonForBuild=%PYTHON%
|
||||||
|
|
||||||
if "%kill%"=="true" call :Kill
|
if "%kill%"=="true" call :Kill
|
||||||
if ERRORLEVEL 1 exit /B 3
|
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
|
||||||
|
|
||||||
|
if "%regen%"=="true" goto :Regen
|
||||||
|
|
||||||
if "%do_pgo%"=="true" (
|
if "%do_pgo%"=="true" (
|
||||||
set conf=PGInstrument
|
set conf=PGInstrument
|
||||||
|
@ -147,6 +153,15 @@ echo on
|
||||||
@echo off
|
@echo off
|
||||||
exit /B %ERRORLEVEL%
|
exit /B %ERRORLEVEL%
|
||||||
|
|
||||||
|
:Regen
|
||||||
|
echo on
|
||||||
|
%MSBUILD% "%dir%\pythoncore.vcxproj" /t:Regen %verbose%^
|
||||||
|
/p:Configuration=%conf% /p:Platform=%platf%^
|
||||||
|
/p:ForceRegen=true
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
exit /B %ERRORLEVEL%
|
||||||
|
|
||||||
:Build
|
:Build
|
||||||
rem Call on MSBuild to do the work, echo the command.
|
rem Call on MSBuild to do the work, echo the command.
|
||||||
rem Passing %1-9 is not the preferred option, but argument parsing in
|
rem Passing %1-9 is not the preferred option, but argument parsing in
|
||||||
|
@ -160,14 +175,6 @@ echo on
|
||||||
/p:UseTestMarker=%UseTestMarker% %GITProperty%^
|
/p:UseTestMarker=%UseTestMarker% %GITProperty%^
|
||||||
%1 %2 %3 %4 %5 %6 %7 %8 %9
|
%1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||||
|
|
||||||
@if not ERRORLEVEL 1 @if "%Regen%"=="true" (
|
|
||||||
%MSBUILD% "%dir%regen.vcxproj" /t:%target% %parallel% %verbose%^
|
|
||||||
/p:IncludeExternals=%IncludeExternals%^
|
|
||||||
/p:Configuration=%conf% /p:Platform=%platf%^
|
|
||||||
/p:UseTestMarker=%UseTestMarker% %GITProperty%^
|
|
||||||
%1 %2 %3 %4 %5 %6 %7 %8 %9
|
|
||||||
)
|
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
exit /b %ERRORLEVEL%
|
exit /b %ERRORLEVEL%
|
||||||
|
|
||||||
|
|
|
@ -513,7 +513,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="_TriggerRegen" BeforeTargets="PrepareForBuild" DependsOnTargets="Regen" />
|
||||||
<Target Name="_GetBuildInfo" BeforeTargets="PrepareForBuild">
|
<Target Name="_GetBuildInfo" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GIT Condition="$(GIT) == ''">git</GIT>
|
<GIT Condition="$(GIT) == ''">git</GIT>
|
||||||
|
|
84
PCbuild/regen.targets
Normal file
84
PCbuild/regen.targets
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Target Name="_SetPythonForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<PythonForBuild>$(PYTHON)</PythonForBuild>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<_PegenSources Include="$(PySourcePath)Grammar\python.gram;$(PySourcePath)Grammar\Tokens" />
|
||||||
|
<_PegenOutputs Include="$(PySourcePath)Parser\parser.c" />
|
||||||
|
<_ASTSources Include="$(PySourcePath)Parser\Python.asdl" />
|
||||||
|
<_ASTOutputs Include="$(PySourcePath)Include\internal\pycore_ast.h">
|
||||||
|
<Argument>-H</Argument>
|
||||||
|
</_ASTOutputs>
|
||||||
|
<_ASTOutputs Include="$(PySourcePath)Include\internal\pycore_ast_state.h">
|
||||||
|
<Argument>-I</Argument>
|
||||||
|
</_ASTOutputs>
|
||||||
|
<_ASTOutputs Include="$(PySourcePath)Python\Python-ast.c">
|
||||||
|
<Argument>-C</Argument>
|
||||||
|
</_ASTOutputs>
|
||||||
|
<_OpcodeSources Include="$(PySourcePath)Tools\scripts\generate_opcode_h.py;$(PySourcePath)Lib\opcode.py" />
|
||||||
|
<_OpcodeOutputs Include="$(PySourcePath)Include\opcode.h;$(PySourcePath)Python\opcode_targets.h" />
|
||||||
|
<_TokenSources Include="$(PySourcePath)Grammar\Tokens" />
|
||||||
|
<_TokenOutputs Include="$(PySourcePath)Doc\library\token-list.inc">
|
||||||
|
<Format>rst</Format>
|
||||||
|
</_TokenOutputs>
|
||||||
|
<_TokenOutputs Include="$(PySourcePath)Include\token.h">
|
||||||
|
<Format>h</Format>
|
||||||
|
</_TokenOutputs>
|
||||||
|
<_TokenOutputs Include="$(PySourcePath)Parser\token.c">
|
||||||
|
<Format>c</Format>
|
||||||
|
</_TokenOutputs>
|
||||||
|
<_TokenOutputs Include="$(PySourcePath)Lib\token.py">
|
||||||
|
<Format>py</Format>
|
||||||
|
</_TokenOutputs>
|
||||||
|
<_KeywordSources Include="$(PySourcePath)Grammar\python.gram;$(PySourcePath)Grammar\Tokens" />
|
||||||
|
<_KeywordOutputs Include="$(PySourcePath)Lib\keyword.py" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="_TouchRegenSources" Condition="$(ForceRegen) == 'true'">
|
||||||
|
<Message Text="Touching source files to force regeneration" Importance="high" />
|
||||||
|
<Touch Files="@(_PegenSources);@(_ASTSources);@(_OpcodeSources);@(_TokenSources);@(_KeywordOutputs)"
|
||||||
|
AlwaysCreate="False" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_RegenPegen" Inputs="@(_PegenSources)" Outputs="@(_PegenOutputs)">
|
||||||
|
<Message Text="Regenerate @(_PegenOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
|
||||||
|
<!-- Specify python.gram with POSIX-like path because the argument gets written into the file verbatim -->
|
||||||
|
<Exec Command="set PYTHONPATH=Tools\peg_generator%0D%0A$(PythonForBuild) -m pegen -q c ./Grammar/python.gram Grammar\Tokens -o Parser\parser.c"
|
||||||
|
WorkingDirectory="$(PySourcePath)" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_RegenAST_H" Inputs="@(_ASTSources)" Outputs="@(_ASTOutputs)">
|
||||||
|
<Message Text="Regenerate @(_ASTOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
|
||||||
|
<Exec Command="$(PythonForBuild) Parser\asdl_c.py Parser\Python.asdl @(_ASTOutputs->'%(Argument) "%(Identity)"',' ')"
|
||||||
|
WorkingDirectory="$(PySourcePath)" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_RegenOpcodes" Inputs="@(_OpcodeSources)" Outputs="@(_OpcodeOutputs)">
|
||||||
|
<Message Text="Regenerate @(_OpcodeOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
|
||||||
|
<Exec Command="$(PythonForBuild) Tools\scripts\generate_opcode_h.py Lib\opcode.py Include\opcode.h"
|
||||||
|
WorkingDirectory="$(PySourcePath)" />
|
||||||
|
<Exec Command="$(PythonForBuild) Python\makeopcodetargets.py Python\opcode_targets.h"
|
||||||
|
WorkingDirectory="$(PySourcePath)" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_RegenTokens" Inputs="@(_TokenSources)" Outputs="@(_TokenOutputs)">
|
||||||
|
<Message Text="Regenerate @(_TokenOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
|
||||||
|
<Exec Command="$(PythonForBuild) Tools\scripts\generate_token.py %(_TokenOutputs.Format) Grammar\Tokens "%(_TokenOutputs.Identity)""
|
||||||
|
WorkingDirectory="$(PySourcePath)" />
|
||||||
|
<Touch Files="@(_TokenOutputs)" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_RegenKeywords" Inputs="@(_KeywordSources)" Outputs="@(_KeywordOutputs)">
|
||||||
|
<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"
|
||||||
|
WorkingDirectory="$(PySourcePath)" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="Regen" DependsOnTargets="_TouchRegenSources;_RegenPegen;_RegenAST_H;_RegenOpcodes;_RegenTokens;_RegenKeywords">
|
||||||
|
<Message Text="Generated sources are up to date" Importance="high" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
|
@ -1,215 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|ARM">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>ARM</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="PGInstrument|ARM">
|
|
||||||
<Configuration>PGInstrument</Configuration>
|
|
||||||
<Platform>ARM</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="PGInstrument|Win32">
|
|
||||||
<Configuration>PGInstrument</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="PGInstrument|x64">
|
|
||||||
<Configuration>PGInstrument</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="PGUpdate|ARM">
|
|
||||||
<Configuration>PGUpdate</Configuration>
|
|
||||||
<Platform>ARM</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="PGUpdate|Win32">
|
|
||||||
<Configuration>PGUpdate</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="PGUpdate|x64">
|
|
||||||
<Configuration>PGUpdate</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|ARM">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>ARM</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{21CF2108-2CC9-4005-A6ED-B7965ADE3854}</ProjectGuid>
|
|
||||||
<Keyword>Win32Proj</Keyword>
|
|
||||||
<RootNamespace>regen</RootNamespace>
|
|
||||||
<SupportPGO>false</SupportPGO>
|
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="python.props" />
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Label="Configuration">
|
|
||||||
<ConfigurationType>Utility</ConfigurationType>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='PGUpdate|x64'">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='PGUpdate|ARM'">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='PGInstrument|ARM'">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='PGInstrument|x64'">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
<Import Project="pyproject.props" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<ItemDefinitionGroup>
|
|
||||||
<ClCompile>
|
|
||||||
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="..\Programs\_freeze_importlib.c" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="pythoncore.vcxproj">
|
|
||||||
<Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
|
|
||||||
<Private>true</Private>
|
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
|
||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
|
||||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
|
||||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\Grammar\Grammar">
|
|
||||||
</None>
|
|
||||||
<None Include="..\Grammar\Tokens">
|
|
||||||
</None>
|
|
||||||
<None Include="..\Include\token.h">
|
|
||||||
</None>
|
|
||||||
<None Include="..\Include\opcode.h">
|
|
||||||
</None>
|
|
||||||
<None Include="..\Include\internal\pycore_ast_state.h">
|
|
||||||
</None>
|
|
||||||
<None Include="..\Include\internal\pycore_ast.h">
|
|
||||||
</None>
|
|
||||||
<None Include="..\Python\Python-ast.c">
|
|
||||||
</None>
|
|
||||||
<None Include="..\Lib\keyword.py">
|
|
||||||
</None>
|
|
||||||
<None Include="..\Lib\symbol.py">
|
|
||||||
</None>
|
|
||||||
<None Include="..\Doc\library\token-list.inc">
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
<Target Name="_RegenPegen" BeforeTargets="Build">
|
|
||||||
<!-- Regenerate Parser/parser.c -->
|
|
||||||
<SetEnv Name="PYTHONPATH" Prefix="true" Value="$(PySourcePath)Tools\peg_generator\" />
|
|
||||||
<Exec Command=""$(PythonExe)" -m pegen -q c "$(PySourcePath)Grammar\python.gram" "$(PySourcePath)Grammar\Tokens" -o "$(IntDir)parser.c"" />
|
|
||||||
<Copy SourceFiles="$(IntDir)parser.c" DestinationFiles="$(PySourcePath)Parser\parser.c">
|
|
||||||
<Output TaskParameter="CopiedFiles" ItemName="_UpdatedParse" />
|
|
||||||
</Copy>
|
|
||||||
<Warning Text="Pegen updated. You will need to rebuild pythoncore to see the changes." Condition="'@(_UpdatedParse)' != ''" />
|
|
||||||
</Target>
|
|
||||||
<Target Name="_RegenAST_H" AfterTargets="_RegenGrammar">
|
|
||||||
<!-- Regenerate Include/internal/pycore_ast.h, Python/Python-ast.c and Include/internal/pycore_ast_state.h using Parser/asdl_c.py -h -->
|
|
||||||
<Exec Command=""$(PythonExe)" "$(PySourcePath)Parser\asdl_c.py" "$(PySourcePath)Parser\Python.asdl" -H "$(IntDir)pycore_ast.h" -C "$(IntDir)Python-ast.c" -I "$(IntDir)pycore_ast_state.h"" />
|
|
||||||
<Copy SourceFiles="$(IntDir)pycore_ast.h" DestinationFiles="$(PySourcePath)Include\internal\pycore_ast.h">
|
|
||||||
<Output TaskParameter="CopiedFiles" ItemName="_UpdatedH" />
|
|
||||||
</Copy>
|
|
||||||
<Copy SourceFiles="$(IntDir)Python-ast.c" DestinationFiles="$(PySourcePath)Python\Python-ast.c">
|
|
||||||
<Output TaskParameter="CopiedFiles" ItemName="_UpdatedC" />
|
|
||||||
</Copy>
|
|
||||||
<Copy SourceFiles="$(IntDir)pycore_ast_state.h" DestinationFiles="$(PySourcePath)Include\internal\pycore_ast_state.h">
|
|
||||||
<Output TaskParameter="CopiedFiles" ItemName="_UpdatedInternalH" />
|
|
||||||
</Copy>
|
|
||||||
<Warning Text="ASDL is updated. You will need to rebuild pythoncore to see the changes." Condition="'@(_UpdatedH)' != '' != '' and '@(_UpdatedC)' != '' and @(_UpdatedInternalH)'" />
|
|
||||||
</Target>
|
|
||||||
<Target Name="_RegenOpcodes" AfterTargets="_RegenAST_C">
|
|
||||||
<!-- Regenerate Include/opcode.h from Lib/opcode.py using Tools/scripts/generate_opcode_h.py-->
|
|
||||||
<Exec Command=""$(PythonExe)" $(PySourcePath)Tools\scripts\generate_opcode_h.py "$(PySourcePath)Lib\opcode.py" "$(IntDir)opcode.h"" />
|
|
||||||
<Copy SourceFiles="$(IntDir)opcode.h" DestinationFiles="$(PySourcePath)Include\opcode.h">
|
|
||||||
<Output TaskParameter="CopiedFiles" ItemName="_Updated" />
|
|
||||||
</Copy>
|
|
||||||
<Warning Text="Opcodes updated. You will need to rebuild pythoncore to see the changes." Condition="'@(_Updated)' != ''" />
|
|
||||||
</Target>
|
|
||||||
<Target Name="_RegenTokens" AfterTargets="_RegenOpcodes">
|
|
||||||
<!-- Regenerate Doc/library/token-list.inc from Grammar/Tokens using Tools/scripts/generate_token.py-->
|
|
||||||
<Exec Command=""$(PythonExe)" $(PySourcePath)Tools\scripts\generate_token.py rst "$(PySourcePath)Grammar\Tokens" "$(PySourcePath)Doc\library\token-list.inc"" />
|
|
||||||
<!-- Regenerate Include/token.h from Grammar/Tokens using Tools/scripts/generate_token.py-->
|
|
||||||
<Exec Command=""$(PythonExe)" $(PySourcePath)Tools\scripts\generate_token.py h "$(PySourcePath)Grammar\Tokens" "$(PySourcePath)Include\token.h"" />
|
|
||||||
<!-- Regenerate Parser/token.c from Grammar/Tokens using Tools/scripts/generate_token.py-->
|
|
||||||
<Exec Command=""$(PythonExe)" $(PySourcePath)Tools\scripts\generate_token.py c "$(PySourcePath)Grammar\Tokens" "$(PySourcePath)Parser\token.c"" />
|
|
||||||
<!-- Regenerate Lib/token.py from Grammar/Tokens using Tools/scripts/generate_token.py -->
|
|
||||||
<Exec Command=""$(PythonExe)" $(PySourcePath)Tools\scripts\generate_token.py py "$(PySourcePath)Grammar\Tokens" "$(PySourcePath)Lib\token.py"" />
|
|
||||||
</Target>
|
|
||||||
<Target Name="_RegenKeywords" AfterTargets="_RegenTokens">
|
|
||||||
<!-- Regenerate Lib/keyword.py from Grammar/python.gram and Grammar/Tokens using Tools/peg_generator/pegen-->
|
|
||||||
<SetEnv Name="PYTHONPATH" Prefix="true" Value="$(PySourcePath)Tools\peg_generator\" />
|
|
||||||
<Exec Command=""$(PythonExe)" -m pegen.keywordgen "$(PySourcePath)Grammar\python.gram" "$(PySourcePath)Grammar\Tokens" "$(IntDir)keyword.py"" />
|
|
||||||
<Copy SourceFiles="$(IntDir)keyword.py" DestinationFiles="$(PySourcePath)Lib\keyword.py">
|
|
||||||
<Output TaskParameter="CopiedFiles" ItemName="_Updated" />
|
|
||||||
</Copy>
|
|
||||||
<Warning Text="Keywords updated. You will need to rebuild pythoncore to see the changes." Condition="'@(_Updated)' != ''" />
|
|
||||||
</Target>
|
|
||||||
<Target Name="_CleanFiles" BeforeTargets="CoreClean">
|
|
||||||
<ItemGroup>
|
|
||||||
<Clean Include="$(IntDir)keyword.py" />
|
|
||||||
<Clean Include="$(IntDir)opcode.h" />
|
|
||||||
<Clean Include="$(IntDir)Python-ast.c" />
|
|
||||||
<Clean Include="$(IntDir)pycore_ast.h" />
|
|
||||||
<Clean Include="$(IntDir)pycore_ast_state.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Target>
|
|
||||||
</Project>
|
|
Loading…
Reference in a new issue