forked from pool/python-django-q
- Fix the libary name in gh-pr-737_importlib.patch OBS-URL: https://build.opensuse.org/request/show/1159299 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:django/python-django-q?expand=0&rev=23
44 lines
1.5 KiB
Diff
44 lines
1.5 KiB
Diff
From cbf7bae709348a4ef37919a447a25eae0438dc68 Mon Sep 17 00:00:00 2001
|
|
From: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
|
|
Date: Sat, 13 Jan 2024 00:03:10 +0100
|
|
Subject: [PATCH] Migrate away from pkg_resources
|
|
|
|
Using pkg_resources as an API is deprecated.
|
|
Migrate functionality to importlib.
|
|
|
|
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
|
|
---
|
|
django_q/conf.py | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/django_q/conf.py b/django_q/conf.py
|
|
index 3a8f3982..d64caa01 100644
|
|
--- a/django_q/conf.py
|
|
+++ b/django_q/conf.py
|
|
@@ -5,7 +5,7 @@
|
|
from signal import signal
|
|
from warnings import warn
|
|
|
|
-import pkg_resources
|
|
+from importlib.metadata import entry_points
|
|
from django.conf import settings
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
@@ -239,13 +239,13 @@ def report(self):
|
|
# iterate through the configured error reporters,
|
|
# and instantiate an ErrorReporter using the provided config
|
|
for name, conf in error_conf.items():
|
|
- for entry in pkg_resources.iter_entry_points(
|
|
- "djangoq.errorreporters", name
|
|
+ for entry in entry_points(
|
|
+ group="djangoq.errorreporters", name=name
|
|
):
|
|
Reporter = entry.load()
|
|
reporters.append(Reporter(**conf))
|
|
error_reporter = ErrorReporter(reporters)
|
|
- except ImportError:
|
|
+ except ModuleNotFoundError:
|
|
error_reporter = None
|
|
else:
|
|
error_reporter = None
|