[Debian-med-packaging] Bug#1092749: Autopkgtests fail with Python 3.13: ipdSummary output changed

Vladimir Petko vpa1977 at gmail.com
Thu Jan 16 19:51:44 GMT 2025


Package: kineticstools
Version: 0.6.1+git20220223.1326a4d+dfsg-3
Followup-For: Bug #1092749
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu plucky ubuntu-patch
Control: tags -1 patch

Dear Maintainer,


In addition to disabling version.t test I had to replace usages of
pkg_resources with importlib.resources. This also had to be done for the
dependencies - python-pbcommand (#1093231) and python-pbcore (#1093230).


In Ubuntu, the attached patch was applied to achieve the following:

  * d/t/control: disable cram autopkgtests. detection_bam* tests are already
    disabled due to the missing data, version.t test fails due to the
    different usage formatting in python 3.13 (LP: #2093383).
  * d/p/remove-pkg-resources.patch: replaces the usages of pkg_resources
    with importlib.resources for Python 3.13 compatibility (LP: #2095050).
  * d/t/control: explicitly add pytest dependencies.


Thanks for considering the patch.


-- System Information:
Debian Release: trixie/sid
  APT prefers oracular-updates
  APT policy: (500, 'oracular-updates'), (500, 'oracular-security'), (500, 'oracular'), (100, 'oracular-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.11.0-13-generic (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru kineticstools-0.6.1+git20220223.1326a4d+dfsg/debian/patches/remove-pkg-resources.patch kineticstools-0.6.1+git20220223.1326a4d+dfsg/debian/patches/remove-pkg-resources.patch
--- kineticstools-0.6.1+git20220223.1326a4d+dfsg/debian/patches/remove-pkg-resources.patch	1970-01-01 12:00:00.000000000 +1200
+++ kineticstools-0.6.1+git20220223.1326a4d+dfsg/debian/patches/remove-pkg-resources.patch	2025-01-13 09:22:59.000000000 +1300
@@ -0,0 +1,58 @@
+Description: Remove usages of pkg_resources
+ pkg_resources are no longer available in Python 3.12 due to setuptools
+ removal from the default installation. This patch replaces the usages of
+ pkg_resources with importlib.resources.
+Author: Vladimir Petko <vladimir.petko at canonical.com>
+Bug: https://github.com/PacificBiosciences/kineticsTools/pull/105
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/kineticstools/+bug/2095050
+Last-Update: 2025-01-16
+
+--- a/kineticsTools/ipdModel.py
++++ b/kineticsTools/ipdModel.py
+@@ -1,4 +1,4 @@
+-from pkg_resources import Requirement, resource_filename
++from importlib import resources
+ import logging
+ import gzip
+ import os.path as op
+@@ -47,9 +47,11 @@
+
+
+ def _getAbsPath(fname):
+-    return resource_filename(Requirement.parse(
+-        'kineticsTools'), 'kineticsTools/%s' % fname)
+-
++    try:
++        with resources.as_file(resources.files('kineticsTools') / fname) as path:
++            return str(path)
++    except:
++        return os.path.join(os.path.dirname(__file__), path)
+
+ class GbmContextModel(object):
+
+--- a/kineticsTools/ipdSummary.py
++++ b/kineticsTools/ipdSummary.py
+@@ -20,7 +20,7 @@
+ import numpy as np
+ import queue
+ import traceback
+-from pkg_resources import Requirement, resource_filename
++from importlib import resources
+
+ from pbcommand.common_options import add_debug_option
+ from pbcommand.cli import get_default_argparser_with_base_opts, pacbio_args_runner
+@@ -43,9 +43,11 @@
+
+
+ def _getResourcePathSpec():
+-    default_dir = resource_filename(Requirement.parse(
+-        'kineticsTools'), 'kineticsTools/resources')
+-    return loader.getResourcePathSpec(default_dir)
++    try:
++        with resources.as_file(resources.files('kineticTools') / 'resources') as path:
++            return loader.getResourcePathSpec(path)
++    except:
++        return loader.getResourcePathSpec(os.path.join(os.path.dirname(__file__), 'resources'))
+
+
+ def _validateResource(func, p):
diff -Nru kineticstools-0.6.1+git20220223.1326a4d+dfsg/debian/patches/series kineticstools-0.6.1+git20220223.1326a4d+dfsg/debian/patches/series
--- kineticstools-0.6.1+git20220223.1326a4d+dfsg/debian/patches/series	2025-01-04 00:05:13.000000000 +1300
+++ kineticstools-0.6.1+git20220223.1326a4d+dfsg/debian/patches/series	2025-01-13 09:22:59.000000000 +1300
@@ -7,3 +7,4 @@
 #ignore_h5py_deprecation_warnings_in_test.patch
 tests2to3.patch
 man-align-cols.patch
+remove-pkg-resources.patch
diff -Nru kineticstools-0.6.1+git20220223.1326a4d+dfsg/debian/tests/control kineticstools-0.6.1+git20220223.1326a4d+dfsg/debian/tests/control
--- kineticstools-0.6.1+git20220223.1326a4d+dfsg/debian/tests/control	2025-01-04 00:05:13.000000000 +1300
+++ kineticstools-0.6.1+git20220223.1326a4d+dfsg/debian/tests/control	2025-01-13 09:22:59.000000000 +1300
@@ -2,11 +2,13 @@
 	cp -r Makefile test $AUTOPKGTEST_TMP/
 	&& cd $AUTOPKGTEST_TMP
 	&& ln -s /usr/share/kineticstools kineticsTools
-	&& make -k py-tests cram-tests
+	&& make -k py-tests
 Depends:
 	make,
 	@,
 	python3-cram,
 	python3-pytest,
+        python3-pytest-cov,
+        python3-pytest-xdist,
 	hdf5-tools,
 Restrictions: allow-stderr,


More information about the Debian-med-packaging mailing list