From ef4c6d5a44153d5ba507d4371cb3dc9e6b038ca1 Mon Sep 17 00:00:00 2001 From: Vladimir Petko Date: Thu, 16 Jan 2025 10:48:47 +1300 Subject: [PATCH] chore(3.12): replace pkg_resources with importlib Python 3.12 removes setuptools from the default installation. Replace pkg_resources calls with importlib APIs. --- pbcommand/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pbcommand/__init__.py b/pbcommand/__init__.py index e5a319d..531b846 100644 --- 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__ = 'unknown' VERSION = (int(x) for x in __VERSION__.split('.'))