Skip to content

Commit

Permalink
Merge pull request #59 from mr-c/version_importlib_metadata_dep
Browse files Browse the repository at this point in the history
Only require importlib_metadata for Python<3.8
  • Loading branch information
mikedarcy authored Dec 4, 2023
2 parents 3daccac + f187cf9 commit 8ee2850
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion bdbag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
import shutil
from datetime import datetime
from distutils.util import strtobool
from importlib_metadata import distribution, PackageNotFoundError
if sys.version_info >= (3,8):
from importlib.metadata import distribution, PackageNotFoundError
else:
from importlib_metadata import distribution, PackageNotFoundError

logger = logging.getLogger(__name__)

Expand Down
6 changes: 5 additions & 1 deletion bdbag/bdbag_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@
# limitations under the License.
#
import os
import sys
import errno
import logging
import json
from collections import OrderedDict
from packaging.version import parse as parse_version
from importlib_metadata import distribution, PackageNotFoundError
if sys.version_info >= (3,8):
from importlib.metadata import distribution, PackageNotFoundError
else:
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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 8ee2850

Please sign in to comment.