Package: automake-1.16
Followup-For: Bug #1061785
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu noble ubuntu-patch
Control: tags -1 patch
Dear Maintainer,
The reason for the autopkgtest failure is that the imp module was
removed from python 3.12. The t/ax/am-test-lib.sh script currently
calls imp.get_tag(), and the recommended[1] way to replace this
functionality is to use sys.implementation.cache_tag.
Thanks for considering the patch.
[1] https://docs.python.org/3.10/library/imp.html#imp.get_tag
diff -Nru
automake-1.16-1.16.5/debian/patches/python3.12-do-not-import-imp.patch
automake-1.16-1.16.5/debian/patches/python3.12-do-not-import-imp.patch
--- automake-1.16-1.16.5/debian/patches/python3.12-do-not-import-imp.patch
1969-12-31 19:00:00.0 -0500
+++ automake-1.16-1.16.5/debian/patches/python3.12-do-not-import-imp.patch
2024-02-01 13:42:56.0 -0500
@@ -0,0 +1,19 @@
+Description: Do not try to import imp module
+ The imp module has been deprecated for a while, and was removed in python3.12.
+ Following the recommendation from python documentation, replace imp.get_tag()
+ usage with sys.implementation.cache_tag.
+Author: Nick Rosbrook
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1061785
+Bug-Ubuntu:
https://bugs.launchpad.net/ubuntu/+source/automake-1.16/+bug/2051972
+Last-Update: 2024-02-01
+--- a/t/ax/am-test-lib.sh
b/t/ax/am-test-lib.sh
+@@ -631,7 +631,7 @@
+ python_has_pep3147 ()
+ {
+ if test -z "$am_pep3147_tag"; then
+-am_pep3147_tag=$($PYTHON -c 'import imp; print(imp.get_tag())') \
++am_pep3147_tag=$($PYTHON -c 'import sys;
print(sys.implementation.cache_tag)') \
+ || am_pep3147_tag=none
+ fi
+ test $am_pep3147_tag != none
diff -Nru automake-1.16-1.16.5/debian/patches/series
automake-1.16-1.16.5/debian/patches/series
--- automake-1.16-1.16.5/debian/patches/series 2022-03-15 19:03:50.0
-0400
+++ automake-1.16-1.16.5/debian/patches/series 2024-02-01 13:36:58.0
-0500
@@ -3,3 +3,4 @@
0003-t-python-prefix.sh-Respect-PYTHON-environment-variable.patch
python3.10.patch
python3.10-sysconfig.patch
+python3.12-do-not-import-imp.patch