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

Only require importlib_metadata for Python<3.8 #59

Merged
merged 2 commits into from
Dec 4, 2023
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
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