With Python 3.10, configure spits out warnings about the module
distutils.sysconfig being deprecated and scheduled for removal in Python
3.12:
<string>:1: DeprecationWarning: The distutils.sysconfig module is
deprecated, use sysconfig instead
<string>:1: DeprecationWarning: The distutils package is deprecated and
slated for removal in Python 3.12. Use setuptools or check PEP 632 for
potential alternatives
This patch changes the uses in configure to use the module sysconfig
instead. The logic stays the same. (It's basically the same module but
as its own top-level module.)
Note that sysconfig exists since Python 2.7, so this moves the minimum
required version up from Python 2.6.
Buildfarm impact:
gaur and prariedog use Python 2.6 and would need to be upgraded.
Possible backpatching:
Backpatching should be considered, since surely someone will otherwise
complain when Python 3.12 comes around. But dropping support for Python
versions in stable branches should be done with some care.
Python 3.10 was released Oct. 4, 2021, so it is quite new. Python major
releases are now yearly, so the above-mentioned Python 3.12 can be
expected in autumn of 2023.
Current PostgreSQL releases support Python versions as follows:
PG10: 2.4+
PG11: 2.4+
PG12: 2.4+ (EOL Nov. 2024)
PG13: 2.6+
PG14: 2.6+
So unfortunately, we won't be able to EOL all versions with Python 2.4
support before Python 3.12 arrives.
I suggest leaving the backbranches alone for now. At the moment, we
don't even know whether additional changes will be required for 3.12
(and 3.11) support, so the overall impact isn't known yet. In a few
months, we will probably know more about this.
In the meantime, the warnings can be silenced using
export PYTHONWARNINGS='ignore::DeprecationWarning'
(It ought to be possible to be more specific, like
'ignore::DeprecationWarning:distutils.sysconfig', but it doesn't seem to
work for me.)
(I don't recommend putting that into configure, since then we wouldn't
be able to learn about issues like this.)