Skip to content

Commit

Permalink
Fix use of importlib.metadata.entry_points in python 3.9
Browse files Browse the repository at this point in the history
entry_points() did not take arguments until python 3.10

Bug: T381734
Change-Id: Ib01641ffa83be1e243615903eca95d872633ff2b
  • Loading branch information
JJMC89 committed Dec 8, 2024
1 parent e232fd3 commit 08c28cb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pywikibot/scripts/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,18 @@ def test_paths(paths, root: Path):

from pywikibot.i18n import set_messages_package

for ep in entry_points(name='scriptspath', group='pywikibot'):
if sys.version_info < (3, 10):
entry_points_items = [
ep for ep in entry_points().get('pywikibot', [])
if ep.name == 'scriptspath'
]
else:
entry_points_items = entry_points(
name='scriptspath',
group='pywikibot',
)

for ep in entry_points_items:
path = ep.load()
found = test_paths([''], path)
if found:
Expand Down

0 comments on commit 08c28cb

Please sign in to comment.