Skip to content

Commit

Permalink
Move from pkg resources to importlib (#172)
Browse files Browse the repository at this point in the history
* move to importlib

* install/use importlib_metadata for py < 3.8

---------

Co-authored-by: Nick Krabbenhoeft <[email protected]>
  • Loading branch information
kba and nkrabben authored Mar 20, 2024
1 parent da5656c commit 44f2139
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bagit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
from functools import partial
from os.path import abspath, isdir, isfile, join

from pkg_resources import DistributionNotFound, get_distribution
try:
from importlib.metadata import version
except ImportError:
from importlib_metadata import version

try:
from urllib.parse import urlparse
Expand All @@ -48,9 +51,8 @@ def find_locale_dir():

LOGGER = logging.getLogger(MODULE_NAME)

try:
VERSION = get_distribution(MODULE_NAME).version
except DistributionNotFound:
VERSION = version(MODULE_NAME)
if not VERSION:
VERSION = "0.0.dev0"

PROJECT_URL = "https://github.com/LibraryOfCongress/bagit-python"
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def get_message_catalogs():
platforms=["POSIX"],
test_suite="test",
setup_requires=["setuptools_scm"],
install_requires=["importlib_metadata ; python_version < '3.8'"],
tests_require=tests_require,
classifiers=[
"License :: Public Domain",
Expand Down

0 comments on commit 44f2139

Please sign in to comment.