Windows CI build fails with "You will need to rebuild pythoncore to see the changes"

I created a PR to test the PEP 580 implementation: https://github.com/python/cpython/pull/12582

However, it’s failing Windows builds on AppVeyor and Azure with
C:\projects\cpython\PCbuild\_freeze_importlib.vcxproj(130,5): error : importlib.h, importlib_external.h, importlib_zipimport.h updated. You will need to rebuild pythoncore to see the changes.

It seems to me that this is a problem with the CI build system, not with my PR (but please correct me if I’m wrong).

CC @steve.dower

Those are generated files. The error probably means you didn’t commit the updated version of those files (after building them locally).

Otherwise it’s a timestamp issue? (do we rely on git timestamps?)

1 Like

I totally was not aware of that. I ran make regen-importlib and it changed something. Let’s see if that fixes it.

In any case, the error message could be improved to mention “make regen-importlib”, I’ll make a PR for that.

2 Likes

Indeed, that fixed it. I was not the first one bitten by this: https://bugs.python.org/issue29631

See https://github.com/python/cpython/pull/12585 for improving that error message.

“make regen-all” isn’t a thing on Windows and the file is already regenerated at that point. If you want to add Linux instructions into the Windows build system, please make clear that they’re for a different platform and are probably only going to be relevant if you’re seeing the error in CI.

Do you have a concrete wording suggestion? How about

If you are not developing on Windows but you see this error on a continuous integration build, remember to run “make regen-all” and commit any changes this makes.

Let me think (and nosy me on the bpo issue). All our CI systems should have an environment variable to detect them by, so we could have an extra message when there’s a chance the developer isn’t building locally. There’s probably general improvements to be had in the message anyway, but bpo is the place and not here.

See https://bugs.python.org/issue36448 but you were already added.