Skip to content

Commit

Permalink
Also move storage plugins to use importlib replacing pkg_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperlees committed Jun 2, 2024
1 parent f405f48 commit 62a9c7e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/bandersnatch/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from typing import IO, Any, Protocol

import filelock
import pkg_resources
from importlib.metadata import entry_points
from packaging.utils import canonicalize_name

from .configuration import BandersnatchConfig
Expand Down Expand Up @@ -320,7 +320,7 @@ def load_storage_plugins(
clear_cache: bool = False,
) -> set[Storage]:
"""
Load all storage plugins that are registered with pkg_resources
Load all storage plugins that are registered with importlib
Parameters
==========
Expand Down Expand Up @@ -361,8 +361,9 @@ def load_storage_plugins(
if cached_plugins:
return set(cached_plugins)

eps = entry_points()
plugins = set()
for entry_point in pkg_resources.iter_entry_points(group=entrypoint_group):
for entry_point in eps.select(group=entrypoint_group):
if entry_point.name == enabled_plugin + "_plugin":
try:
plugin_class = entry_point.load()
Expand Down

0 comments on commit 62a9c7e

Please sign in to comment.