Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from pkg resources to importlib #172

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading