Skip to content

Commit

Permalink
importlib_metadata removed deprecated entry point interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
woutdenolf committed Oct 3, 2022
1 parent 7c1dcd0 commit d3addea
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
12 changes: 11 additions & 1 deletion celery/bin/celery.py
@@ -1,5 +1,6 @@
"""Celery Command Line Interface."""
import os
import sys
import pathlib
import traceback

Expand Down Expand Up @@ -75,7 +76,16 @@ def convert(self, value, param, ctx):
APP = App()


@with_plugins(entry_points().get('celery.commands', []))
if sys.version_info >= (3,10):
_PLUGINS = entry_points(group='celery.commands')
else:
try:
_PLUGINS = entry_points().get('celery.commands', [])
except AttributeError:
_PLUGINS = entry_points().select('celery.commands', [])


@with_plugins(_PLUGINS)
@click.group(cls=DYMGroup, invoke_without_command=True)
@click.option('-A',
'--app',
Expand Down
9 changes: 8 additions & 1 deletion celery/utils/imports.py
Expand Up @@ -141,7 +141,14 @@ def gen_task_name(app, name, module_name):


def load_extension_class_names(namespace):
for ep in entry_points().get(namespace, []):
if sys.version_info >= (3,10):
_entry_points = entry_points(group='celery.commands')
else:
try:
_entry_points = entry_points().get('celery.commands', [])
except AttributeError:
_entry_points = entry_points().select('celery.commands', [])
for ep in _entry_points:
yield ep.name, ep.value


Expand Down

0 comments on commit d3addea

Please sign in to comment.