Hi,

Shouldn't AM_PATH_PYTHON check for the python3 command before python?
The full recommendation of how these should be setup is in PEP 394
[1].

On modern systems I don't think it should matter. On Fedora 40:

    $ command -v python
    /usr/bin/python
    $ command -v python3
    /usr/bin/python3
    $ python --version
    Python 3.12.3
    $ python3 --version
    Python 3.12.3

The difference mostly exists on older machines. On CentOS 7.9 for
example:

    $ command -v python
    /usr/bin/python
    $ command -v python3
    /usr/bin/python3
    $ python --version
    Python 2.7.5
    $ python3 --version
    Python 3.6.8

I've attached a proposed path. I don't see a situation where a
python3.* is installed without a python3 link. Therefore checking for
python3 and fallingback on python seems reasonable to me.

Collin

[1] https://peps.python.org/pep-0394/
From cd88a2461f0c89c2e70a7fc3a17058fb989313d4 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Thu, 20 Jun 2024 02:26:52 -0700
Subject: [PATCH] python: Prefer python3 over python

* m4/python.m4 (AM_PATH_PYTHON): Check for python3 before python.
* NEWS: Document that python3 is used first.
---
 NEWS         | 2 +-
 m4/python.m4 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 77347e5a3..99c562f15 100644
--- a/NEWS
+++ b/NEWS
@@ -7,7 +7,7 @@ New in 1.17:
 
 * New features added
 
-  - AM_PATH_PYTHON will, after checking "python", prefer any Python 3
+  - AM_PATH_PYTHON will, after checking "python3", prefer any Python 3
     version (latest versions checked first) over any Python 2
     version. If a specific version of Python 2 is still needed, the
     $PYTHON variable should be set beforehand.
diff --git a/m4/python.m4 b/m4/python.m4
index 0b1db2689..21116e1a3 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -37,7 +37,7 @@ AC_DEFUN([AM_PATH_PYTHON]
   dnl Find a Python interpreter.  Python versions prior to 2.0 are not
   dnl supported. (2.0 was released on October 16, 2000).
   m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
-[python python3 dnl
+[python3 python dnl
  python3.20 python3.19 python3.18 python3.17 python3.16 dnl
  python3.15 python3.14 python3.13 python3.12 python3.11 python3.10 dnl
  python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl
-- 
2.45.2

Reply via email to