Fix build with Python 3.12

Python 3.12 dropped the long-deprecated imp module, and no longer
ships pathfix.py.
This commit is contained in:
Yaakov Selkowitz 2023-07-07 14:03:00 -04:00
parent 0437cded0b
commit 5d939a3d52
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 020f008cc58f9cb61baaa175ae1fcb6c4faca55b Mon Sep 17 00:00:00 2001
From: Yaakov Selkowitz <yselkowi@redhat.com>
Date: Fri, 7 Jul 2023 13:57:28 -0400
Subject: [PATCH] Fix fedabipkgdiff configure check for Python 3.12
importlib is the Python 3 replacement to imp, which was deprecated in
Python 3.4 and removed in 3.12.
* configure.ac (REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF):
Test for importlib.machinery instead of imp with python3.
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
---
configure.ac | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index b4e7e38e..b3f97ba2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -739,13 +739,15 @@ if test x$CHECK_DEPS_FOR_FEDABIPKGDIFF = xyes; then
# urllib.parse. Oh well.
if test x$PYTHON = xpython3; then
URLPARSE_MODULE=urllib.parse
+ IMPORT_MODULE=importlib.machinery
else
URLPARSE_MODULE=urlparse
+ IMPORT_MODULE=imp
fi
REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF="\
argparse logging os re subprocess sys $URLPARSE_MODULE \
- xdg koji mock rpm imp tempfile mimetypes shutil six"
+ xdg koji mock rpm $IMPORT_MODULE tempfile mimetypes shutil six"
AX_CHECK_PYTHON_MODULES([$REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF],
[$PYTHON],
--
2.41.0

View File

@ -9,6 +9,9 @@ Summary: Set of ABI analysis tools
License: ASL 2.0 License: ASL 2.0
URL: https://sourceware.org/libabigail/ URL: https://sourceware.org/libabigail/
Source0: http://mirrors.kernel.org/sourceware/libabigail/%{tarball_name}.tar.xz Source0: http://mirrors.kernel.org/sourceware/libabigail/%{tarball_name}.tar.xz
# fix configure for removal of 'imp' in Python 3.12; code already fixed
# https://sourceware.org/pipermail/libabigail/2023q3/005581.html
Patch0: 0001-Fix-fedabipkgdiff-configure-check-for-Python-3.12.patch
BuildRequires: binutils-devel BuildRequires: binutils-devel
@ -92,6 +95,7 @@ them manually.
%prep %prep
%setup -n %{tarball_name} %setup -n %{tarball_name}
%patch -P 0 -p1
%build %build
%configure --enable-ctf --disable-silent-rules --disable-zip-archive --disable-static %configure --enable-ctf --disable-silent-rules --disable-zip-archive --disable-static
@ -115,7 +119,7 @@ make -C doc/manuals install-man-and-info-doc DESTDIR=%{buildroot}
%if 0%{?fedora} %if 0%{?fedora}
# Explicitly use Python 3 as the interpreter # Explicitly use Python 3 as the interpreter
pathfix.py -i %{__python3} -pn %{buildroot}%{_bindir}/fedabipkgdiff %py3_shebang_fix %{buildroot}%{_bindir}/fedabipkgdiff
%endif %endif
%check %check