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-43567: Improved generated code refresh on Windows #25120
Conversation
|
Can you also add the lines needed to regenerate opcode.h and other files that must ge regenerated when opcode.py changes? See "make regen-opcode regen-opcode-targets". Also, frozen imports (basically everything done by "make regen-all"). |
|
Opcodes are regenerated in there already, there's just no command line option. Is there a need for one? It all regens pretty quick, and not at all if the files haven't been touched. Frozen imports still have to be generated by the built CPython, so they're still in the |
I tested this as follows: add a new opcode to Lib/opcode.py, add a case for it in Python/ceval.c, run PCbuild\build.bat. This gives an error in ceval.c, and opcode.h is not regenerated. What am I missing?
Okay, that seems to be working. The workflow seems to be as follows:
I'm guessing that I was used to the Mac/Linux workflow where this is part of make regen-all. But I don't see opcode.h being regenerated. |
PCbuild/regen.targets
Outdated
| @@ -19,6 +19,8 @@ | |||
| <_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" /> | |||
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.
There's also opcode_targets.h, which is generated by this snippet in Makefile.pre.in:
regen-opcode-targets:
# Regenerate Python/opcode_targets.h from Lib/opcode.py
# using Python/makeopcodetargets.py
$(PYTHON_FOR_REGEN) $(srcdir)/Python/makeopcodetargets.py \
$(srcdir)/Python/opcode_targets.h.new
$(UPDATE_FILE) $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/opcode_targets.h.new
Yes! This all works now.
I still find this block of errors hard to read:
C:\Users\gvanrossum\cpython\PCbuild\_freeze_importlib.vcxproj(146,5): error : importlib.h, importlib_external.h, import
lib_zipimport.h updated. You will need to rebuild pythoncore to see the changes.
C:\Users\gvanrossum\cpython\PCbuild\_freeze_importlib.vcxproj(146,5): error :
C:\Users\gvanrossum\cpython\PCbuild\_freeze_importlib.vcxproj(146,5): error : If 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.
1 Warning(s)
1 Error(s)
It's a lot of text that basically means "please re-run PCbuild\build.bat again," but I understand that the error may be produced in contexts where that phrasing wouldn't work either.
We should probably add a few words to the devguide section for Windows once this lands.
|
Yes, we expanded that text because it was confusing people when it was shorter. Tweaking it to just say "rebuild everything" rather than "pythoncore" probably makes sense. I'll do that before merging. Unfortunately, I don't think I can get rid of the full path of the project before the message... |
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.
Do we really need the part @(_Updated->'%(Filename)%(Extension)',', ') updated.? That makes the first line of the error twice as long. And I'd change "You will need to" into "Please".
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'll move the list of files into a regular message, so it gets logged, but doesn't make the important message noisy.
|
Thanks! |
Generated files are now refreshed automatically on regular build, or may be forcibly regenerated by calling `build.bat --regen`.
Generated files are now refreshed automatically (based on last modified timestamp, which Git preserves) in Windows builds, or can be manually refreshed by calling "build.bat --regen".
https://bugs.python.org/issue43567