Skip to content

Commit

Permalink
Forgot to commit changes: Removed dependency on pkg_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
heuer committed Oct 26, 2023
1 parent 0f0fa61 commit 3a3052c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 6 additions & 3 deletions segno/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,10 +950,13 @@ def __getattr__(self, name):
of invoking the function depends on the plugin.
"""
if name.startswith('to_'):
from pkg_resources import iter_entry_points
try:
from importlib import metadata
except ImportError: # Python < 3.8
import importlib_metadata as metadata
from functools import partial
for ep in iter_entry_points(group='segno.plugin.converter',
name=name[3:]):
for ep in metadata.entry_points(group='segno.plugin.converter',
name=name[3:]):
plugin = ep.load()
return partial(plugin, self)
raise AttributeError('{0} object has no attribute {1}'
Expand Down
1 change: 0 additions & 1 deletion tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"""\
Tests plugin loading.
"""
import os
import pytest
import segno

Expand Down

0 comments on commit 3a3052c

Please sign in to comment.