From 8a688f4251b040f4877727e2c77beac5316889c1 Mon Sep 17 00:00:00 2001 From: Chris Burr Date: Sun, 9 Jun 2024 22:54:37 +0200 Subject: [PATCH] fix: pkg_resources deprecation warnings --- src/DIRAC/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DIRAC/__init__.py b/src/DIRAC/__init__.py index 04301701856..d24c7988da5 100755 --- a/src/DIRAC/__init__.py +++ b/src/DIRAC/__init__.py @@ -55,12 +55,12 @@ """ import os +import importlib.metadata import re import sys import warnings from pkgutil import extend_path from typing import Any, Optional, Union -from pkg_resources import get_distribution, DistributionNotFound __path__ = extend_path(__path__, __name__) @@ -81,9 +81,9 @@ # Define Version try: - __version__ = get_distribution(__name__).version + __version__ = importlib.metadata.version(__name__) version = __version__ -except DistributionNotFound: +except importlib.metadata.PackageNotFoundError: # package is not installed version = "Unknown"