Skip to content

Commit

Permalink
no longer use pkg_resource
Browse files Browse the repository at this point in the history
  • Loading branch information
gawel committed Jan 3, 2025
1 parent 53abc03 commit 5709af0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,6 @@
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

import pkg_resources
version = pkg_resources.get_distribution("irc3").version
from importlib.metadata import version
version = version("irc3")
release = version
33 changes: 12 additions & 21 deletions irc3/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,15 @@
import signal
import logging
import logging.config
from importlib import metadata
from . import utils
from . import config
from .compat import asyncio
from .compat import reload_module
from collections import defaultdict

try:
import pkg_resources
from pkg_resources import iter_entry_points
HAS_PKG_RESOURCES = True
except ImportError: # pragma: no cover
HAS_PKG_RESOURCES = False
version = ''
else:
try:
version = pkg_resources.get_distribution('irc3').version
except pkg_resources.DistributionNotFound:
version = ''

version = metadata.version('irc3')


class Registry:
Expand Down Expand Up @@ -200,15 +191,15 @@ def include(self, *modules, **kwargs):
try:
module = utils.maybedotted(module)
except LookupError as exc:
if HAS_PKG_RESOURCES:
entry_points = iter_entry_points(
'irc3.loader',
module
)
try:
module = next(entry_points).load()
except StopIteration:
raise exc
entry_points = metadata.entry_points().get('irc3.loader')
for eps in entry_points:
if eps.name == module:
try:
module = eps.load()
except ImportError:
raise exc
else:
break
else:
raise exc
# we have to manualy check for plugins. venusian no longer
Expand Down

0 comments on commit 5709af0

Please sign in to comment.