From 748283819043c60b1cb272c2cc9ab5b457afb03a Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 6 Apr 2021 23:54:43 +0100 Subject: [PATCH] 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`. --- .../2021-03-31-19-50-01.bpo-43567.vd0a-p.rst | 1 + PCbuild/_freeze_importlib.vcxproj | 8 +- PCbuild/build.bat | 27 ++- PCbuild/pythoncore.vcxproj | 2 + PCbuild/regen.targets | 84 +++++++ PCbuild/regen.vcxproj | 215 ------------------ 6 files changed, 109 insertions(+), 228 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2021-03-31-19-50-01.bpo-43567.vd0a-p.rst create mode 100644 PCbuild/regen.targets delete mode 100644 PCbuild/regen.vcxproj diff --git a/Misc/NEWS.d/next/Build/2021-03-31-19-50-01.bpo-43567.vd0a-p.rst b/Misc/NEWS.d/next/Build/2021-03-31-19-50-01.bpo-43567.vd0a-p.rst new file mode 100644 index 00000000000..062662f6bce --- /dev/null +++ b/Misc/NEWS.d/next/Build/2021-03-31-19-50-01.bpo-43567.vd0a-p.rst @@ -0,0 +1 @@ +Improved generated code refresh (AST/tokens/opcodes/keywords) on Windows. diff --git a/PCbuild/_freeze_importlib.vcxproj b/PCbuild/_freeze_importlib.vcxproj index a0fe49c464d..52d8f1a64bb 100644 --- a/PCbuild/_freeze_importlib.vcxproj +++ b/PCbuild/_freeze_importlib.vcxproj @@ -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(` `, ` `))')"> - - + - + + git diff --git a/PCbuild/regen.targets b/PCbuild/regen.targets new file mode 100644 index 00000000000..4d386cfa5f3 --- /dev/null +++ b/PCbuild/regen.targets @@ -0,0 +1,84 @@ + + + + + $(PYTHON) + + + + + <_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"> + -H + + <_ASTOutputs Include="$(PySourcePath)Include\internal\pycore_ast_state.h"> + -I + + <_ASTOutputs Include="$(PySourcePath)Python\Python-ast.c"> + -C + + <_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"> + rst + + <_TokenOutputs Include="$(PySourcePath)Include\token.h"> + h + + <_TokenOutputs Include="$(PySourcePath)Parser\token.c"> + c + + <_TokenOutputs Include="$(PySourcePath)Lib\token.py"> + py + + <_KeywordSources Include="$(PySourcePath)Grammar\python.gram;$(PySourcePath)Grammar\Tokens" /> + <_KeywordOutputs Include="$(PySourcePath)Lib\keyword.py" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PCbuild/regen.vcxproj b/PCbuild/regen.vcxproj deleted file mode 100644 index ef355a21820..00000000000 --- a/PCbuild/regen.vcxproj +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Debug - ARM - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - ARM - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - ARM - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - ARM - - - Release - Win32 - - - Release - x64 - - - - {21CF2108-2CC9-4005-A6ED-B7965ADE3854} - Win32Proj - regen - false - 10.0 - - - - - Utility - Unicode - - - v142 - - - v142 - - - v142 - - - v142 - - - v142 - - - v142 - - - v142 - - - v142 - - - v142 - - - v142 - - - v142 - - - v142 - - - - - - - - - - - - _CONSOLE;%(PreprocessorDefinitions) - - - Console - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - true - true - false - true - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -