Skip to content

Commit cd18731

Browse files
committed
configure: Update python search order
Some systems don't ship with "python" by default anymore, only "python3" or "python2" or some combination, so include those in the configure search. Discussion: https://www.postgresql.org/message-id/flat/1457.1543184081%40sss.pgh.pa.us#c9cc1199338fd6a257589c6dcea6cf8d
1 parent 10ab852 commit cd18731

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

config/python.m4

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@
88
# ----------------
99
# Look for Python and set the output variable 'PYTHON' if found,
1010
# fail otherwise.
11+
#
12+
# As the Python 3 transition happens and PEP 394 isn't updated, we
13+
# need to cater to systems that don't have unversioned "python" by
14+
# default. Some systems ship with "python3" by default and perhaps
15+
# have "python" in an optional package. Some systems only have
16+
# "python2" and "python3", in which case it's reasonable to prefer the
17+
# newer version.
1118
AC_DEFUN([PGAC_PATH_PYTHON],
12-
[PGAC_PATH_PROGS(PYTHON, python)
19+
[PGAC_PATH_PROGS(PYTHON, [python python3 python2])
1320
if test x"$PYTHON" = x""; then
1421
AC_MSG_ERROR([Python not found])
1522
fi

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8031,7 +8031,7 @@ fi
80318031

80328032
if test "$with_python" = yes; then
80338033
if test -z "$PYTHON"; then
8034-
for ac_prog in python
8034+
for ac_prog in python python3 python2
80358035
do
80368036
# Extract the first word of "$ac_prog", so it can be a program name with args.
80378037
set dummy $ac_prog; ac_word=$2

doc/src/sgml/installation.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,8 @@ su - postgres
14731473
<![%standalone-include[the <application>PL/Python</>
14741474
documentation]]>
14751475
<![%standalone-ignore[<xref linkend="plpython-python23">]]>
1476-
for more information. The default is <command>python</command>.
1476+
for more information. If this is not set, the following are probed
1477+
in this order: <literal>python python3 python2</literal>.
14771478
</para>
14781479
</listitem>
14791480
</varlistentry>

0 commit comments

Comments
 (0)