Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upbpo-36500: Enable Windows users to regen grammar, opcodes, tokens and symbols from Visual Studio #12654
Conversation
…pythoncore as uses python*.exe binary to run the new Pgen module
This comment has been minimized.
This comment has been minimized.
Added |
This comment has been minimized.
This comment has been minimized.
Added |
This comment has been minimized.
This comment has been minimized.
Added |
Right now this can't be a part of every build because it touches too many files. That's okay, but then I'd like a Alternatively, this could regenerate everything but only update source files that have changed (and break the build at that point), and otherwise leave everything clean. Then we could make it part of the regular build and wouldn't need the current freeze_importlib project. But it's got to not touch anything that doesn't need touching and not pollute the source directories. |
<!-- Regenerate Include/Python-ast.h using Parser/asdl_c.py -h --> | ||
<Exec Command=""$(OutDir)python$(PyDebugExt).exe" "..\Parser\asdl_c.py" -h "..\Include\Python-ast.h.new" "..\Parser\Python.asdl"" /> | ||
<Copy SourceFiles="..\Include\Python-ast.h.new" DestinationFiles="..\Include\Python-ast.h"> | ||
<Output TaskParameter="CopiedFiles" ItemName="_UpdatedH" /> |
This comment has been minimized.
This comment has been minimized.
zooba
Apr 2, 2019
Member
This isn't sufficient for detecting files that were regenerated without changing. Look in the importlib one for the contents check.
(If you want an excuse to learn about target batching in MSBuild - which is ridiculously powerful - you might consider having one target for doing the optional-copy and fail if updated step, then pass it all the target files in an ItemGroup with the generated file as metadata.)
This comment has been minimized.
This comment has been minimized.
tonybaloney
Apr 2, 2019
•
Author
Contributor
@zooba It copies them regardless in the same way that the Makefile
does, which is why this project is an optional configuration and not part of the Debug or Release build dependencies.
Would you like me to add this check and make regen.vcxproj
build automatically?
This comment has been minimized.
This comment has been minimized.
zooba
Apr 12, 2019
Member
Yep, that'll be most reliable.
If you add all the source files as items in the project then it should skip rebuilding if none of them have changed.
This comment has been minimized.
This comment has been minimized.
tonybaloney
May 9, 2019
Author
Contributor
I've tried the target batching, it doesn't seem to be able to determine any better than this revision whether the contents have changed. The docs say that it uses timestamps on the files to determine (which won't work in this case)
This comment has been minimized.
This comment has been minimized.
zooba
May 15, 2019
Member
Yeah, you'll need to do content comparisons. See what the current freezeimportlib project does.
This comment has been minimized.
This comment has been minimized.
@zooba please could you review, instead of having regen.bat, I've added a |
This comment has been minimized.
This comment has been minimized.
Actually, I’m going to remove the project from the solution and remove the errors and turn them into warnings |
</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)" ..\Tools\scripts\generate_opcode_h.py "..\Lib\opcode.py" "$(IntDir)opcode.h"" /> |
This comment has been minimized.
This comment has been minimized.
zooba
May 15, 2019
Member
I'm not keen on the relative paths here. We have $(PySourcePath)
for the root of the sources.
This comment has been minimized.
This comment has been minimized.
@zooba please can you review with the changes you requested. |
Misc/NEWS.d/next/Build/2019-04-02-01-59-26.bpo-36500.fyG6_U.rst
Outdated
Show resolved
Hide resolved
…er must have built the binaries first before using the process. Also fix a leading '.' in the vcxproj
This comment has been minimized.
This comment has been minimized.
Modified the
|
This comment has been minimized.
This comment has been minimized.
@zooba please could you look at this for going into 3.9-master? |
tonybaloney commentedApr 2, 2019
•
edited
Adds an additional project to the PCbuild.sln that runs the equivalent commands that are in the
regen-all
stage in the Makefile.Currently implements:
regen-grammar
regen-opcode
regen-token
regen-keyword
regen-symbol
regen-ast
Has a custom clean stage to delete intermediate files.
Uses the generated python.exe from pythoncore, and so marks pythoncore as a depedency.
The solution file does not mark this project as to be built in the Debug or Release profiles (same as freezeimportlib)
@zooba
TODO:
https://bugs.python.org/issue36500