From 25e0a6e17267623eb99d167e80472d7d2a4809a6 Mon Sep 17 00:00:00 2001 From: rwx403335 Date: Tue, 28 Dec 2021 17:25:37 +0800 Subject: [PATCH] determine python 3.10 version number correctlly --- automake.spec | 8 +- ...-Python-3.10-version-number-correctl.patch | 97 +++++++++++++++++++ 2 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 backport-python-determine-Python-3.10-version-number-correctl.patch diff --git a/automake.spec b/automake.spec index 259d3e3..aba6176 100644 --- a/automake.spec +++ b/automake.spec @@ -4,7 +4,7 @@ Name: automake Version: 1.16.2 -Release: 3 +Release: 4 Summary: A tool for automatically generating Makefile.in files License: GPLv2+ and GFDL and Public Domain and MIT URL: http://www.gnu.org/software/automake/ @@ -14,6 +14,7 @@ Source2: http://git.savannah.gnu.org/cgit/config.git/plain/config.guess Patch1: tests-require-etags-for-tags-lisp-space-test.patch Patch2: tests-support-fno-common-in-vala-mix2-test.patch +Patch3: backport-python-determine-Python-3.10-version-number-correctl.patch BuildArch: noarch @@ -21,7 +22,7 @@ BuildArch: noarch #that success through rpmbuild but fail on obs Patch0: 0001-disable-three-tests.patch -BuildRequires: perl autoconf make help2man automake perl-generators +BuildRequires: perl autoconf make help2man automake perl-generators texinfo #for tests BuildRequires: libtool gettext-devel flex bison vala BuildRequires: cscope dejagnu sharutils gcc-gfortran @@ -76,6 +77,9 @@ fi %{_mandir}/man1/* %changelog +* Tue Dec 28 2021 renhongxun - 1.16.2-4 +- bugfix about python 3.10 + * Fri Jul 30 2021 panxiaohe - 1.16.2-3 - Support -fno-common in vala-mix2 test diff --git a/backport-python-determine-Python-3.10-version-number-correctl.patch b/backport-python-determine-Python-3.10-version-number-correctl.patch new file mode 100644 index 0000000..e0d6dc0 --- /dev/null +++ b/backport-python-determine-Python-3.10-version-number-correctl.patch @@ -0,0 +1,97 @@ +From e21d46fddd0753e66a4acda88317670fee07f3e6 Mon Sep 17 00:00:00 2001 +From: "Miro Hron\\v{c}ok" +Date: Tue, 27 Oct 2020 14:33:46 -0700 +Subject: [PATCH] python: determine Python (3.10) version number correctly. + +This change fixes https://bugs.gnu.org/44239 +(and https://bugzilla.redhat.com/show_bug.cgi?id=1889732). + +* m4/python.m4: use print('%u.%u' % sys.version_info[:2]) for +the version number instead of merely sys.version[:3], so the +numbers are treated as numbers. +* t/python-vars.sh (PYTHON_VERSION): Likewise. +* doc/automake.texi: Document it. +* NEWS: mention it. (Minor tweaks from Karl Berry.) +--- + NEWS | 2 ++ + doc/automake.texi | 2 +- + m4/python.m4 | 12 +++++++----- + t/python-vars.sh | 4 +++- + 4 files changed, 13 insertions(+), 7 deletions(-) + +diff --git a/NEWS b/NEWS +index fa35bf1..9c69e48 100644 +--- a/NEWS ++++ b/NEWS +@@ -74,6 +74,8 @@ New in 1.16.2: + + * Bugs fixed + ++ - Python 3.10 version number no longer considered to be 3.1. ++ + - When cleaning the compiled python files, '\n' is not used anymore in the + substitution text of 'sed' transformations. This is done to preserve + compatibility with the 'sed' implementation provided by macOS which +diff --git a/doc/automake.texi b/doc/automake.texi +index ed7e2e2..17bc2da 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{'%u.%u' % sys.version_info[:2]}. + + @item PYTHON_PREFIX + The string @samp{$@{prefix@}}. This term may be used in future work +diff --git a/m4/python.m4 b/m4/python.m4 +index 16c2f4f..b2302ba 100644 +--- a/m4/python.m4 ++++ b/m4/python.m4 +@@ -1,7 +1,7 @@ + ## ------------------------ -*- Autoconf -*- + ## Python file handling + ## From Andrew Dalke +-## Updated by James Henstridge ++## Updated by James Henstridge and other contributors. + ## ------------------------ + # Copyright (C) 1999-2020 Free Software Foundation, Inc. + # +@@ -86,12 +86,14 @@ AC_DEFUN([AM_PATH_PYTHON], + m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) + else + +- dnl Query Python for its version number. Getting [:3] seems to be +- dnl the best way to do this; it's what "site.py" does in the standard +- dnl library. ++ dnl Query Python for its version number. Although site.py simply uses ++ dnl sys.version[:3], printing that failed with Python 3.10, since the ++ dnl trailing zero was eliminated. So now we output just the major ++ dnl and minor version numbers, as numbers. Apparently the tertiary ++ dnl version is not of interest. + + AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], +- [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) ++ [am_cv_python_version=`$PYTHON -c "import sys; print('%u.%u' % sys.version_info[[:2]])"`]) + AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) + + dnl Use the values of $prefix and $exec_prefix for the corresponding +diff --git a/t/python-vars.sh b/t/python-vars.sh +index 5c748bc..b53018b 100644 +--- a/t/python-vars.sh ++++ b/t/python-vars.sh +@@ -28,7 +28,9 @@ 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 ++# ++# This version identification is duplicated in python.m4 (and the manual). ++PYTHON_VERSION=$($PYTHON -c 'import sys; print("%u.%u" % 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}' +-- +1.8.3.1 + -- Gitee