Skip to content

Commit

Permalink
Merge pull request #204 from Honny1/fix-deprecation-warning
Browse files Browse the repository at this point in the history
Fix deprecation warning
  • Loading branch information
jan-cerny authored Aug 7, 2023
2 parents 0aecd7a + e9bfc3f commit 1b26699
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions openscap_report/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# Copyright 2022, Red Hat, Inc.
# SPDX-License-Identifier: LGPL-2.1-or-later

from importlib.metadata import PackageNotFoundError, version
from os import path

from pkg_resources import DistributionNotFound, get_distribution

DISTRIBUTION_NAME = "openscap-report"
try:
distribution = get_distribution(DISTRIBUTION_NAME)
except DistributionNotFound:
__version__ = version(DISTRIBUTION_NAME)
except PackageNotFoundError:
__version__ = f"Version is unavailable. Please install {DISTRIBUTION_NAME}!"
else:
__version__ = distribution.version

0 comments on commit 1b26699

Please sign in to comment.