Subject: bug#28160: Support newer version of python

From: Mathieu Lirzin <[email-masked]>
Date: Sat, 03 Mar 2018 13:00:22 +0100

Hello,

Mathieu Lirzin <[email-masked]> writes:

> Mathieu Lirzin <[email-masked]> writes:
>
>>>>>From 1d60fb72168e62d33fe433380af621de64e22f23 Mon Sep 17 00:00:00 2001
>> From: Mathieu Lirzin <[email-masked]>
>> Date: Thu, 1 Feb 2018 13:51:03 +0100
>> Subject: [PATCH] python: Generate python interpreter list
>>
>> _AM_PYTHON_INTERPRETER_LIST is used by AM_PYTHON_PATH to autodetect
>> Python programs whose names correspond to a specific Python
>> version (e.g. python3.6).  Previously this list was updated manually.
>> The automatic support of newer versions (up to 4.0 excluded) fixes
>> bug#28160.
>>
>> * m4/python.m4 (am_py_min_ver, am_py_max_ver): New macros.
>> (_AM_PYTHON_INTERPRETER_LIST): Generate this list instead of hard-coding
>> it.  Implementation is taken from GNU Pyconfigure.
>> ---
>>  m4/python.m4 | 21 +++++++++++++++++----
>>  1 file changed, 17 insertions(+), 4 deletions(-)
>
> Pushed as commit 1d60fb72168e62d33fe433380af621de64e22f23

This commit has brought the issue described in automake bug#30616 [1].

I initially was not happy with solution of manually defining future
versions, but after reflection it seems that the maintainability issue
of updating it manually doesn't worth the complexity of generating it
with M4.  Here is an alternative patch to fixes this bug, that I intend
to push tomorrow.

>From 88df0576249df21e719ff3ac95d3d27b77e3370f Mon Sep 17 00:00:00 2001
From: Mathieu Lirzin <[email-masked]>
Date: Sat, 3 Mar 2018 12:01:13 +0100
Subject: [PATCH] python: Support future python version up to 3.9

This change fixes automake bug#28160.

Since AM_PYTHON_PATH macro takes no maximum version argument, there is
no need to generate _AM_PYTHON_INTERPRETER_LIST dynamically, like what
was previously done by the reverted commit
1d60fb72168e62d33fe433380af621de64e22f23.  We could rely on M4 to
generate this list statically however this is likely to be a complex
solution that would not improve maintainability.

* m4/python.m4 (_AM_PYTHON_INTERPRETER_LIST): Add 'python3.7',
'python3.8', and 'python3.9'.
---
 m4/python.m4 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/m4/python.m4 b/m4/python.m4
index 58dd18761..63c0a0e04 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -36,11 +36,12 @@ 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).
-  dnl FIXME: Remove the need to hard-code Python versions here.
   m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
-[python python2 python3 python3.6 python3.5 python3.4 python3.3 python3.2 dnl
- python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 dnl
- python2.2 python2.1 python2.0])
+[python python2 python3 dnl
+ python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl
+ python3.2 python3.1 python3.0 dnl
+ python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl
+ python2.0])
 
   AC_ARG_VAR([PYTHON], [the Python interpreter])
 
-- 
2.16.2

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30616
-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37