-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-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
Added |
Added |
Added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 PCbuild/regen.bat
script for launching it from the command line.
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" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you'll need to do content comparisons. See what the current freezeimportlib project does.
@zooba please could you review, instead of having regen.bat, I've added a |
Actually, I’m going to remove the project from the solution and remove the errors and turn them into warnings |
PCbuild/regen.vcxproj
Outdated
</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"" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not keen on the relative paths here. We have $(PySourcePath)
for the root of the sources.
@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
Modified the
|
Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
@zooba please could you look at this for going into 3.9-master? |
…an regen grammar, opcodes, tokens and symbols (pythonGH-12654)
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