Skip to content

Commit

Permalink
Update feeluown/plugin.py
Browse files Browse the repository at this point in the history
Co-authored-by: Shaowen Yin <[email protected]>
  • Loading branch information
mokurin000 and cosven authored Jan 23, 2024
1 parent b62972a commit e4d216b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions feeluown/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,13 @@ def _scan_entry_points(self):
https://packaging.python.org/guides/creating-and-discovering-plugins/
"""
try:
import importlib_metadata # pylint: disable=redefined-outer-name
entry_points = importlib_metadata.entry_points() \
.select(group='fuo.plugins_v1')
import importlib.metadata # pylint: disable=redefined-outer-name
try:
entry_points = importlib.metadata.entry_points() \
.select(group='fuo.plugins_v1')
except AttributeError: # old version does not has `select` method
entry_points = importlib.metadata.entry_points() \
.get('fuo.plugins_v1', [])
except ImportError:
import pkg_resources
entry_points = pkg_resources.iter_entry_points('fuo.plugins_v1')
Expand Down

0 comments on commit e4d216b

Please sign in to comment.