Package: python-pbcommand Version: 2.1.1+git20220616.3f2e6c2-3 Severity: important Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu plucky ubuntu-patch
Dear Maintainer, Adding a simple autopkgtest `python -c "import pbcommand"` fails with the following error: autopkgtest [10:41:25]: test command1: python3 -c "import pbcommand" autopkgtest [10:41:25]: test command1: [----------------------- Traceback (most recent call last): File "<string>", line 1, in <module> import pbcommand File "/tmp/autopkgtest.Lo75OZ/build.glM/real-tree/pbcommand/__init__.py", line 1, in <module> import pkg_resources ModuleNotFoundError: No module named 'pkg_resources' autopkgtest [10:41:26]: test command1: -----------------------] This is due to python 3.12 removing setuptools from the default installation. In Ubuntu, the attached patch was applied to achieve the following: * d/p/remove-pkg-resources.patch: replace the usages of pkg_resources with importlib.resources for Python 3.13 compatibility (LP: #2095045). * d/t/control: add smoke test. 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
diff -Nru python-pbcommand-2.1.1+git20220616.3f2e6c2/debian/patches/remove-pkg-resources.patch python-pbcommand-2.1.1+git20220616.3f2e6c2/debian/patches/remove-pkg-resources.patch --- python-pbcommand-2.1.1+git20220616.3f2e6c2/debian/patches/remove-pkg-resources.patch 1970-01-01 12:00:00.000000000 +1200 +++ python-pbcommand-2.1.1+git20220616.3f2e6c2/debian/patches/remove-pkg-resources.patch 2025-01-16 11:00:11.000000000 +1300 @@ -0,0 +1,24 @@ +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.pe...@canonical.com> +Bug: https://github.com/PacificBiosciences/pbcommand/pull/191 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/python-pbcommand/+bug/2095045 +Last-Update: 2025-01-16 + +--- a/pbcommand/__init__.py ++++ b/pbcommand/__init__.py +@@ -1,9 +1,9 @@ +-import pkg_resources ++from importlib.metadata import Distribution, PackageNotFoundError + import sys + + try: +- __VERSION__ = pkg_resources.get_distribution('pbcommand').version +-except Exception: ++ __VERSION__ = Distribution.from_name('pbcommand').version ++except PackageNotFoundError: + __VERSION__ = '2.4.0' + + VERSION = (int(x) for x in __VERSION__.split('.')) diff -Nru python-pbcommand-2.1.1+git20220616.3f2e6c2/debian/patches/series python-pbcommand-2.1.1+git20220616.3f2e6c2/debian/patches/series --- python-pbcommand-2.1.1+git20220616.3f2e6c2/debian/patches/series 2024-03-23 06:58:36.000000000 +1300 +++ python-pbcommand-2.1.1+git20220616.3f2e6c2/debian/patches/series 2025-01-16 11:00:11.000000000 +1300 @@ -1,2 +1,3 @@ python3.patch fix_version.patch +remove-pkg-resources.patch diff -Nru python-pbcommand-2.1.1+git20220616.3f2e6c2/debian/tests/control python-pbcommand-2.1.1+git20220616.3f2e6c2/debian/tests/control --- python-pbcommand-2.1.1+git20220616.3f2e6c2/debian/tests/control 2024-03-23 06:58:36.000000000 +1300 +++ python-pbcommand-2.1.1+git20220616.3f2e6c2/debian/tests/control 2025-01-16 11:00:11.000000000 +1300 @@ -1,3 +1,7 @@ Tests: run-unit-test Depends: @, python3-pytest, python3-pytest-xdist, python3-pytest-cov, python3-pbcore Restrictions: allow-stderr, skip-not-installable + +Test-Command: python3 -c "import pbcommand" +Depends: @ +Restrictions: allow-stderr, skip-not-installable