Skip to content

Commit

Permalink
Only require importlib_metadata for Python<3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Nov 23, 2023
1 parent 3daccac commit 4b7525f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion bdbag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
import shutil
from datetime import datetime
from distutils.util import strtobool
from importlib_metadata import distribution, PackageNotFoundError

try:
from importlib.metadata import distribution, PackageNotFoundError
except ImportError: # Python < 3.8
from importlib_metadata import distribution, PackageNotFoundError

logger = logging.getLogger(__name__)

Expand Down
5 changes: 4 additions & 1 deletion bdbag/bdbag_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
import json
from collections import OrderedDict
from packaging.version import parse as parse_version
from importlib_metadata import distribution, PackageNotFoundError
try:
from importlib.metadata import distribution, PackageNotFoundError
except ImportError: # Python < 3.8
from importlib_metadata import distribution, PackageNotFoundError
from bdbag import get_typed_exception, safe_move, \
DEFAULT_CONFIG_PATH, BAG_PROFILE_TAG, BDBAG_PROFILE_ID, VERSION, __version__
from bdbag.fetch import Megabyte
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
'tzlocal',
'requests',
'certifi',
'importlib_metadata',
"importlib_metadata;python_version<'3.8'",
'packaging',
'bagit',
'bagit_profile'
Expand All @@ -63,7 +63,7 @@
'tzlocal',
'certifi',
'packaging',
'importlib-metadata',
"importlib_metadata;python_version<'3.8'",
'requests>=2.7.0',
'setuptools_scm<6.0', # for bagit which does not properly include it in install_requires
'bagit==1.8.1',
Expand Down

0 comments on commit 4b7525f

Please sign in to comment.