Re: Replace uses of deprecated Python module distutils.sysconfig
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Andrew Dunstan <andrew@dunslane.net>, pgsql-hackers@lists.postgresql.org
Date: 2022-01-24T00:42:41Z
Lists: pgsql-hackers
Hi,
On 2022-01-23 19:00:41 -0500, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2022-01-23 18:31:44 -0500, Tom Lane wrote:
> >> Yeah, but we don't know whether there are any versions of the Debian
> >> packaging in which they fixed the file layout, so that 'posix_local'
> >> actually does describe the layout.
>
> > I think posix_local try to achieve something different than what you assume it
> > does. It's intended to return the location to which "locally" intalled python
> > extension install their files (including headers) - after having the problem
> > that such local python package installations overwrite (and thus broke) files
> > installed via the system mechanism.
>
> Okay, but surely they'd have thought of packages that just want to find
> out where the system Python headers are?
I think this might be problem on our own end, actually. The distutils.sysconfig
code did
a = '-I' + distutils.sysconfig.get_python_inc(False)
b = '-I' + distutils.sysconfig.get_python_inc(True)
which the patch upthread changed to
+a = '-I' + sysconfig.get_path('include')
+b = '-I' + sysconfig.get_path('platinclude')
but I think that's possibly not quite the right translation?
The recommended way to find flags to compile against python appears to be the
python$version-config binary. To which we might not want to switch.
But even so, it seems using sysconfig.get_config_vars('INCLUDEPY') or such
seems like it might be a better translation than the above
sysconfig.get_path() stuff?
For me that returns more sensible paths.
Greetings,
Andres Freund
Commits
-
Replace use of deprecated Python module distutils.sysconfig, take 2.
- e41176bd6f47 11.15 landed
- aa2215d6b8ac 12.10 landed
- a72c430120cf 10.20 landed
- 803f0b173906 14.2 landed
- 4d7d196ff693 13.6 landed
- bd233bdd8dd9 15.0 landed
-
Temporarily add some information about python include paths to configure.
- f032f63e727c 15.0 landed
-
Revert "Make configure prefer python3 to plain python."
- 512fc2dd790e 15.0 landed
-
Make configure prefer python3 to plain python.
- f201da39edcd 15.0 landed
-
Replace use of deprecated Python module distutils.sysconfig
- e0e567a10672 15.0 landed