bpo-32430: During 'configure', don't copy Setup.dist to Setup. by nascheme · Pull Request #8260 · python/cpython
In the past, users building Python were expected to modify the Modules/Setup file. In that case, preserving their local modifications on re-execution of 'configure' was useful. Further, to support users modifying Setup and re-runnning make, there was dependency rules in the Makefile to re-run makesetup if needed, which would re-generate Makefile and Modules/config.c. For modern builds of Python, most users never touch Modules/Setup. In that case, the behavior of preserving Modules/Setup is counter-productive since updating Modules/Setup.dist will result in a stale copy of Modules/Setup being used. In that case 'make' outputs a warning. In the past, the warning was the last output from 'make'. Now we run setup.py and so that warning is buried under a pile of build tool output. So, the net effect is that the build can fail and the user doesn't know how to fix it. Running 'configure' again is not sufficient because the out-of-date Modules/Setup file is preserved. This change does the following: - In 'configure', don't create Modules/Setup from Modules/Setup.dist. If the user wants a customized Setup, they will have to copy it themselves. - In 'makesetup', if Modules/Setup does not exist, read the config from Modules/Setup.dist. Note this is a bit tricky since the source and build folders can be separate (i.e. $srcdir/Modules/xyx is not the same as Modules/xyz). The effect of this change is that if Modules/Setup exists, it will be used in preference to Modules/Setup.dist. - In the 'Makefile', stop checking for an out-of-date Modules/Setup file. If the user is creating Setup, we will have to trust them to keep it up-to-date. That should not be a problem for 3rd party distributions like Red Hat, Debian, etc. They would normally start a build from a clean source tree and so nothing should be out-of-date. - In the 'Makefile', remove the dependency rule to re-run 'makesetup'. Again, this should never be necessary in the normal case. Running 'configure' will result in 'makesetup' getting run. There is also a make target 'makesetup' if someone wants to modify Modules/Setup and wishes to re-generate Makefile and Modules/config.c. Run "make makesetup" will process Setup/Setup.dist. - Change getpath.c to look for Modules/config.c as the marker for a source folder. That file gets generated and so we can use it in the same way that Modules/Setup was previously used. This marker is important in the case that separate build and source folders are being used.