1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
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@canonical.com>
Bug: https://github.com/PacificBiosciences/pbcommand/pull/191
Bug-Debian: https://bugs.debian.org/1093231
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('.'))
|