Skip to content
Closed
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
21 changes: 12 additions & 9 deletions src/pushsource/_impl/source.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import inspect
import functools
import inspect
import logging
import os
from importlib.metadata import entry_points
from threading import Lock
from urllib import parse

import pkg_resources

from pushsource._impl.helpers import wait_exist

LOG = logging.getLogger("pushsource")
Expand Down Expand Up @@ -128,12 +127,16 @@ def __ensure_init(cls):

@classmethod
def __load_entrypoints(cls):
for ep in pkg_resources.iter_entry_points("pushsource"):
# Note we're just trying to import the entry point's module, not
# call any method.
# resolve vs load is for different versions of pkg_resources.
# Result is assigned to a var to avoid a pylint warning.
_ = ep.resolve() if hasattr(ep, "resolve") else ep.load(require=False)
# Note we're just trying to import the entry point's module, not
# call any method.
eps = entry_points(group="pushsource")

for ep in eps:
try:
# Just import the module behind the entry point
_ = ep.load()
except Exception as e:
LOG.warning("Failed to load entry point %s: %s", ep, e)

@classmethod
def get(cls, source_url, **kwargs):
Expand Down
Loading