[med-svn] [Git][med-team/python-pbcore][master] * d/p/remove-pkg-resources.patch: replace the usages of pkg_resources
Andreas Tille (@tille)
gitlab at salsa.debian.org
Sun Feb 16 14:06:03 GMT 2025
Andreas Tille pushed to branch master at Debian Med / python-pbcore
Commits:
0394386b by Andreas Tille at 2025-02-16T15:02:10+01:00
* d/p/remove-pkg-resources.patch: replace the usages of pkg_resources
with importlib.resources for Python 3.13 compatibility
Closes: #1093230 (LP: #2095040).
* d/t/control: add smoke test.
- - - - -
4 changed files:
- debian/changelog
- + debian/patches/remove-pkg-resources.patch
- debian/patches/series
- debian/tests/control
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+python-pbcore (2.1.2+dfsg-11) UNRELEASED; urgency=medium
+
+ * d/p/remove-pkg-resources.patch: replace the usages of pkg_resources
+ with importlib.resources for Python 3.13 compatibility
+ Closes: #1093230 (LP: #2095040).
+ * d/t/control: add smoke test.
+
+ -- Andreas Tille <tille at debian.org> Sun, 16 Feb 2025 15:01:30 +0100
+
python-pbcore (2.1.2+dfsg-10) unstable; urgency=medium
* Remove intersphinx
=====================================
debian/patches/remove-pkg-resources.patch
=====================================
@@ -0,0 +1,117 @@
+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/pbcore/pull/126
+Bug-Debian: https://bugs.debian.org/1093230
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/python-pbcore/+bug/2095040
+Last-Update: 2025-01-15
+
+--- a/pbcore/data/datasets/__init__.py
++++ b/pbcore/data/datasets/__init__.py
+@@ -1,7 +1,7 @@
+ """Doctest resources"""
+
+ import os
+-from pkg_resources import Requirement, resource_filename
++from importlib import resources
+
+ XML_FILES = ["alignment.dataset.xml", # 0
+ "barcode.dataset.xml",
+@@ -33,8 +33,10 @@
+
+
+ def _getAbsPath(fname):
+- return resource_filename(Requirement.parse('pbcore'),
+- 'pbcore/data/datasets/%s' % fname)
++ with resources.as_file(
++ resources.files('pbcore') /
++ 'data/datasets' / fname) as ret:
++ return str(ret)
+
+
+ def getXml(no=0):
+--- a/pbcore/data/__init__.py
++++ b/pbcore/data/__init__.py
+@@ -1,4 +1,4 @@
+-from pkg_resources import Requirement, resource_filename
++from importlib import resources
+
+ MOVIE_NAME_14 = "m110818_075520_42141_c100129202555500000315043109121112_s1_p0"
+ MOVIE_NAME_20 = "m130522_092457_42208_c100497142550000001823078008081323_s1_p0"
+@@ -9,7 +9,10 @@
+
+
+ def _getAbsPath(fname):
+- return resource_filename(Requirement.parse('pbcore'), 'pbcore/data/%s' % fname)
++ with resources.as_file(
++ resources.files('pbcore') /
++ 'data' / fname) as ret:
++ return str(ret)
+
+
+ def getCCSBAM():
+--- a/pbcore/__init__.py
++++ b/pbcore/__init__.py
+@@ -1,6 +1,6 @@
+-import pkg_resources
++from importlib.metadata import Distribution, PackageNotFoundError
+
+ try:
+- __VERSION__ = pkg_resources.get_distribution('pbcore').version
+-except Exception:
++ __VERSION__ = Distribution.from_name('pbcore').version
++except PackageNotFoundError:
+ __VERSION__ = 'unknown'
+--- a/pbcore/chemistry/chemistry.py
++++ b/pbcore/chemistry/chemistry.py
+@@ -6,7 +6,7 @@
+ import xml.etree.ElementTree as ET
+ import os.path
+
+-from pkg_resources import Requirement, resource_filename
++from importlib import resources
+
+
+ class ChemistryLookupError(Exception):
+@@ -35,12 +35,16 @@
+
+ def _loadBarcodeMappings():
+ try:
+- mappingFname = resource_filename(Requirement.parse(
+- 'pbcore'), 'pbcore/chemistry/resources/mapping.xml')
++ mappingFnameContext = resources.as_file(
++ resources.files('pbcore') /
++ 'chemistry/resources/mapping.xml')
++ with mappingFnameContext as mappingFname:
++ mappings = _loadBarcodeMappingsFromFile(mappingFname)
+ except:
+ mappingFname = os.path.join(os.path.dirname(__file__),
+- 'resources/mapping.xml')
+- mappings = _loadBarcodeMappingsFromFile(mappingFname)
++ 'resources/mapping.xml')
++ mappings = _loadBarcodeMappingsFromFile(mappingFname)
++
+ updMappingDir = os.getenv("SMRT_CHEMISTRY_BUNDLE_DIR")
+ if updMappingDir:
+ import logging
+--- a/doc/conf.py
++++ b/doc/conf.py
+@@ -11,12 +11,13 @@
+ # All configuration values have a default; values that are commented out
+ # serve to show the default.
+
+-import pkg_resources
+ import sys, os
+
++from importlib.metadata import Distribution, PackageNotFoundError
++
+ try:
+- __VERSION__ = pkg_resources.get_distribution('pbcore').version
+-except Exception:
++ __VERSION__ = Distribution.from_name('pbcore').version
++except PackageNotFoundError:
+ __VERSION__ = 'unknown'
+
+
=====================================
debian/patches/series
=====================================
@@ -4,3 +4,4 @@ b24746790c7105212e45dc2f40115d231bd8baae.patch
seek-curdir-for-xml.patch
numpy_1.24.patch
no-intersphinx.patch
+remove-pkg-resources.patch
=====================================
debian/tests/control
=====================================
@@ -2,3 +2,8 @@ Tests: run-unit-test
Depends: @, python3-pytest, python3-pytest-runner, python3-pytest-xdist, python3-pytest-cov
Restrictions: allow-stderr
Architecture: amd64 arm64 ppc64el
+
+Test-Command: python3 -c "import pbcore"
+Depends: @
+Restrictions: allow-stderr
+Architecture: amd64 arm64 ppc64el
View it on GitLab: https://salsa.debian.org/med-team/python-pbcore/-/commit/0394386bd056c9173a2910b8df5f06b635b084da
--
View it on GitLab: https://salsa.debian.org/med-team/python-pbcore/-/commit/0394386bd056c9173a2910b8df5f06b635b084da
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20250216/415f39f0/attachment-0001.htm>
More information about the debian-med-commit
mailing list