void-packages/srcpkgs/python3-signedjson/patches/importlib_metadata.patch

40 lines
1.3 KiB
Diff

From c40c83f844fee3c1c7b0c5d1508f87052334b4e5 Mon Sep 17 00:00:00 2001
From: MeggyCal <MeggyCal@users.noreply.github.com>
Date: Tue, 21 Apr 2020 18:55:37 +0200
Subject: [PATCH] Do not require importlib_metadata on python 3.8. (#9)
---
setup.py | 2 +-
signedjson/__init__.py | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/setup.py b/setup.py
index 9c09760..c1cc299 100755
--- a/setup.py
+++ b/setup.py
@@ -41,7 +41,7 @@ def read_file(path_segments):
"pynacl>=0.3.0",
"typing_extensions>=3.5",
'typing>=3.5;python_version<"3.5"',
- "importlib_metadata",
+ 'importlib_metadata;python_version<"3.8"',
],
long_description=read_file(("README.rst",)),
keywords="json",
diff --git a/signedjson/__init__.py b/signedjson/__init__.py
index 6641e64..62faa5e 100644
--- a/signedjson/__init__.py
+++ b/signedjson/__init__.py
@@ -12,7 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from importlib_metadata import version, PackageNotFoundError
+try:
+ from importlib.metadata import version, PackageNotFoundError
+except ImportError: # pragma: nocover
+ from importlib_metadata import version, PackageNotFoundError
try:
__version__ = version(__name__)