Python versions (was Re: RHEL 8.0 build) - Mailing list pgsql-hackers

From Tom Lane
Subject Python versions (was Re: RHEL 8.0 build)
Date
Msg-id 1457.1543184081@sss.pgh.pa.us
Whole thread Raw
In response to Re: RHEL 8.0 build  (Andres Freund <andres@anarazel.de>)
Responses Re: Python versions (was Re: RHEL 8.0 build)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2018-11-24 15:49:25 -0500, Tom Lane wrote:
>> There's been some preliminary discussion about starting to default to
>> python3, but given this project's inherent conservatism, I don't expect
>> that to happen for some years yet.  In any case, whenever we do pull
>> that trigger we'd surely do so only in HEAD not released branches, so
>> buildfarm owners will need to deal with the case for years more.

> Why don't we probe for python2 in addition to python by default? That
> ought to make RHEL 8 work, without making the switch just yet.

I'm unexcited about that because that *would* be expressing a version
preference --- and one that's on the wrong side of history.

Also, I noticed on a fresh FreeBSD 12.0 installation that what
I've got is

$ ls /usr/bin/pyth*
ls: /usr/bin/pyth*: No such file or directory
$ ls /usr/local/bin/pyth*
/usr/local/bin/python2.7
/usr/local/bin/python2.7-config
/usr/local/bin/python3.6
/usr/local/bin/python3.6-config
/usr/local/bin/python3.6m
/usr/local/bin/python3.6m-config

So there are modern platforms on which "python2" isn't going to make
it work automatically either.

At some point I think what we're going to want to do is to probe for,
in order, $PYTHON, python, python3, python3.7, python3.6, ..., python3.0,
python2, python2.7, python2.6, ..., python2.4 (or whatever our minimum
supported version is).  However, I don't think we are ready to put in a
preference towards python3 yet, and it's hard to see how to do something
like this while still being version agnostic.

[ thinks for awhile ... ]  Maybe we could do something like this:

1. If $PYTHON exists, use that.

2. If "python" exists, use that.

3. Probe all the numbered python versions suggested above.  If
*exactly one* of them exists, use that.

4. Otherwise complain and tell user to resolve uncertainty by
setting $PYTHON.

That's still not quite right, because it'd get confused by
something like symlinking python3 to python3.6, which you'd
kind of wish didn't confuse it.  But you could imagine sweating
over this for an hour or two and getting something that generally
did the right thing, and maybe with another hour or two on docs
you could explain it reasonably.  I'm unconvinced that it's worth
the trouble though; I think we're better off waiting until we can
go with a straight prefer-the-newest-version rule.  With where the
world is right now, it seems to me that making the user specify
which Python to use is arguably a feature not a bug.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Petr Jelinek
Date:
Subject: Re: Continue work on changes to recovery.conf API
Next
From: Stephen Frost
Date:
Subject: Re: Continue work on changes to recovery.conf API