Hi, we have encountered an issue[1] with the python double-digit version detection.
The used `sys.version[:3]` used in automake strips digits from the python version. For example '3.10' is detected as '3.1'. To fix this issue, `sys.version[:3]` is changed to `sys.version_info[:2]` in the attached patch. Version: 1.16.2 How to reproduce: Use automake with python 3.10 (or any double-digit version) More details can be found in the bugzilla below if needed. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1889732 -- Patrik Novotný Associate Software Engineer Red Hat panov...@redhat.com
From 8e8033dd0cbb618326ca1af3b188432ac5c16f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Novotn=C3=BD?= <panovotn@redhat.com> Date: Mon, 26 Oct 2020 13:29:53 +0100 Subject: [PATCH] Fix double-digit python version detection * doc/automake.texi: Fix double-digit python version deteciton. * t/python-vars.sh: Likewise. --- doc/automake.texi | 2 +- t/python-vars.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/automake.texi b/doc/automake.texi index ed7e2e242..37626be8e 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -7861,7 +7861,7 @@ AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :]) @item PYTHON_VERSION The Python version number, in the form @var{major}.@var{minor} (e.g., @samp{2.5}). This is currently the value of -@samp{sys.version[:3]}. +@samp{sys.version_info[:2]}. @item PYTHON_PREFIX The string @samp{$@{prefix@}}. This term may be used in future work diff --git a/t/python-vars.sh b/t/python-vars.sh index 5c748bcf1..6b5426c43 100644 --- a/t/python-vars.sh +++ b/t/python-vars.sh @@ -28,7 +28,7 @@ CONFIG_SITE=/dev/null; export CONFIG_SITE # vary among different python installations, so we need more relaxed # and ad-hoc checks for them. Also, more proper "functional" checks # on them should be done in the 'python-virtualenv.sh' test. -PYTHON_VERSION=$($PYTHON -c 'import sys; print(sys.version[:3])') || exit 1 +PYTHON_VERSION=$($PYTHON -c 'import sys; print(sys.version_info[:2])') || exit 1 PYTHON_PLATFORM=$($PYTHON -c 'import sys; print(sys.platform)') || exit 1 PYTHON_EXEC_PREFIX='${exec_prefix}' PYTHON_PREFIX='${prefix}' -- 2.26.2