From ded9c1d281db73a03f487243ed414ffd94b5acce Mon Sep 17 00:00:00 2001
From: Dominik George <nik@naturalnet.de>
Date: Sun, 15 Nov 2020 14:00:49 +0100
Subject: [PATCH] Use backported importlib_metadata on Python 3.7

---
 aleksis/core/util/core_helpers.py | 7 ++++++-
 poetry.lock                       | 6 +++---
 pyproject.toml                    | 1 +
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/aleksis/core/util/core_helpers.py b/aleksis/core/util/core_helpers.py
index c711bb3d4..6b5c01c6f 100644
--- a/aleksis/core/util/core_helpers.py
+++ b/aleksis/core/util/core_helpers.py
@@ -1,12 +1,17 @@
 import os
 import time
 from datetime import datetime, timedelta
-from importlib import import_module, metadata
+from importlib import import_module
 from itertools import groupby
 from operator import itemgetter
 from typing import Any, Callable, Optional, Sequence, Union
 from uuid import uuid4
 
+try:
+    from importlib import metadata
+except ImportError:
+    import importlib_metadata as metadata
+
 from django.conf import settings
 from django.db.models import Model, QuerySet
 from django.http import HttpRequest
diff --git a/poetry.lock b/poetry.lock
index 2b1410b2e..48fe5a27a 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -2117,7 +2117,7 @@ ldap = ["django-auth-ldap"]
 [metadata]
 lock-version = "1.1"
 python-versions = "^3.7"
-content-hash = "f92e91f0541f9d10f25ba28110c66ccad38f513c811319f512efabde376a6c2a"
+content-hash = "17b0d85895314506bd849fc661907901cf538ce1e6ad7571b9f921660d7df6c8"
 
 [metadata.files]
 alabaster = [
@@ -2671,8 +2671,6 @@ pillow = [
     {file = "Pillow-7.2.0-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:5e51ee2b8114def244384eda1c82b10e307ad9778dac5c83fb0943775a653cd8"},
     {file = "Pillow-7.2.0-cp38-cp38-win32.whl", hash = "sha256:725aa6cfc66ce2857d585f06e9519a1cc0ef6d13f186ff3447ab6dff0a09bc7f"},
     {file = "Pillow-7.2.0-cp38-cp38-win_amd64.whl", hash = "sha256:a060cf8aa332052df2158e5a119303965be92c3da6f2d93b6878f0ebca80b2f6"},
-    {file = "Pillow-7.2.0-pp36-pypy36_pp73-macosx_10_10_x86_64.whl", hash = "sha256:9c87ef410a58dd54b92424ffd7e28fd2ec65d2f7fc02b76f5e9b2067e355ebf6"},
-    {file = "Pillow-7.2.0-pp36-pypy36_pp73-manylinux2010_x86_64.whl", hash = "sha256:e901964262a56d9ea3c2693df68bc9860b8bdda2b04768821e4c44ae797de117"},
     {file = "Pillow-7.2.0-pp36-pypy36_pp73-win32.whl", hash = "sha256:25930fadde8019f374400f7986e8404c8b781ce519da27792cbe46eabec00c4d"},
     {file = "Pillow-7.2.0.tar.gz", hash = "sha256:97f9e7953a77d5a70f49b9a48da7776dc51e9b738151b22dacf101641594a626"},
 ]
@@ -2941,6 +2939,8 @@ restructuredtext-lint = [
     {file = "ruamel.yaml.clib-0.2.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:5254af7d8bdf4d5484c089f929cb7f5bafa59b4f01d4f48adda4be41e6d29f99"},
     {file = "ruamel.yaml.clib-0.2.2-cp38-cp38-win32.whl", hash = "sha256:74161d827407f4db9072011adcfb825b5258a5ccb3d2cd518dd6c9edea9e30f1"},
     {file = "ruamel.yaml.clib-0.2.2-cp38-cp38-win_amd64.whl", hash = "sha256:058a1cc3df2a8aecc12f983a48bda99315cebf55a3b3a5463e37bb599b05727b"},
+    {file = "ruamel.yaml.clib-0.2.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c6ac7e45367b1317e56f1461719c853fd6825226f45b835df7436bb04031fd8a"},
+    {file = "ruamel.yaml.clib-0.2.2-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:b4b0d31f2052b3f9f9b5327024dc629a253a83d8649d4734ca7f35b60ec3e9e5"},
     {file = "ruamel.yaml.clib-0.2.2.tar.gz", hash = "sha256:2d24bd98af676f4990c4d715bcdc2a60b19c56a3fb3a763164d2d8ca0e806ba7"},
 ]
 rules = [
diff --git a/pyproject.toml b/pyproject.toml
index b3e4c1480..7c4a6922b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -88,6 +88,7 @@ django-health-check = "^3.12.1"
 psutil = "^5.7.0"
 celery-progress = "^0.0.12"
 django-prometheus = "^2.1.0"
+importlib-metadata = {version = "^2.0.0", python = "<3.8"}
 
 [tool.poetry.extras]
 ldap = ["django-auth-ldap"]
-- 
GitLab