Re: Replace uses of deprecated Python module distutils.sysconfig

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Replace uses of deprecated Python module distutils.sysconfig
Date: 2022-01-24 02:53:01
Message-ID: 20220124025301.qu36x44w6m67cnap@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-01-23 21:31:52 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > No, not really. There generally seems to be very little documentation about
> > what one is supposed to use when embedding python (rather than building a
> > python module). The only thing I really see is:
>
> > https://docs.python.org/3/extending/embedding.html#compiling-and-linking-under-unix-like-systems
>
> > which says to use python-config.
>
> Yeah :-(. I don't really want to go there, because it will break
> existing setups.

Yea, it seems to introduce a whole set of new complexities (finding python
from python-config, mismatching python-config and explicitly specified python,
...). And it doesn't exist on windows either :(.

> Getting back to the INCLUDEPY solution: I see nothing equivalent
> to that for the "platform-dependent include directory". But maybe
> we don't really need that? Not clear.

I don't really understand what the various "platform" variables / paths are
supposed to do. I think it might only differ when compiling stuff as part of
(or against) the python source tree.

To avoid too noisy breakages, we could have python.m4 emit INCLUDEPY and then
search the bf logs in a day or three?

Not that that's any guarantee, but it's maybe worth a bit that INCLUDEPY is
one of the few wars that sysconfig.py explicitly computes for windows builds [2].

Greetings,

Andres Freund

[2] https://github.com/python/cpython/blob/3.10/Lib/sysconfig.py#L487

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2022-01-24 02:53:26 Re: Skipping logical replication transactions on subscriber side
Previous Message Andres Freund 2022-01-24 02:38:34 Re: XLogReadRecord() error in XlogReadTwoPhaseData()