Bug#1061785: automake-1.16 fails its autopkg tests with Python 3.12

2024-02-01 Thread Nick Rosbrook
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


Bug#1061785: automake-1.16 fails its autopkg tests with Python 3.12

2024-01-29 Thread Matthias Klose

Package: src:automake-1.16
Version: 1:1.16.5-1.3
Severity: important
Tags: sid trixie ftbfs
User: debian-pyt...@lists.debian.org
Usertags: python3.12

With python3-defaults from experimental, the package fails its autopkg 
tests:


[...]
3716s PASS: t/programs-primary-rewritten.sh
3716s FAIL: t/py-compile-basic.sh
3717s FAIL: t/py-compile-basedir.sh
3717s FAIL: t/py-compile-destdir.sh
3717s PASS: t/py-compile-env.sh
3717s FAIL: t/py-compile-option-terminate.sh
3717s PASS: t/py-compile-usage.sh
3719s PASS: t/python.sh
3722s PASS: t/python2.sh
3724s FAIL: t/python3.sh
3726s FAIL: t/python10.sh
3727s PASS: t/python11.sh
3730s FAIL: t/python12.sh
3731s PASS: t/python-am-path-iftrue.sh
3733s PASS: t/python-missing.sh
3733s PASS: t/python-too-old.sh
3735s PASS: t/python-dist.sh
3738s FAIL: t/python-prefix.sh
3746s PASS: t/python-vars.sh
3749s FAIL: t/python-virtualenv.sh
3751s FAIL: t/python-pr10995.sh
3756s PASS: t/recurs-user.sh