summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-09-13 00:52:05 +0200
committerMichał Górny <mgorny@gentoo.org>2020-09-13 00:58:21 +0200
commitc24c654c3d877d497cb5c224b437547fea5b4a1c (patch)
treea6180e6d5ce3ac53e5b6bbbb5aeea7d1ba8dde78 /dev-python/jsonpickle
parentdev-lang/python: Refactor 2.7.18 patches for more consistency (diff)
downloadgentoo-c24c654c3d877d497cb5c224b437547fea5b4a1c.tar.gz
gentoo-c24c654c3d877d497cb5c224b437547fea5b4a1c.tar.bz2
gentoo-c24c654c3d877d497cb5c224b437547fea5b4a1c.zip
dev-python/jsonpickle: Backport importlib_metadata fix + add dep
Backport a fix not to require importlib_metadata in py3.8+, and add a missing dep on it for earlier implementations. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/jsonpickle')
-rw-r--r--dev-python/jsonpickle/files/jsonpickle-1.4.1-importlib-metadata.patch44
-rw-r--r--dev-python/jsonpickle/jsonpickle-1.4.1-r2.ebuild (renamed from dev-python/jsonpickle/jsonpickle-1.4.1-r1.ebuild)7
2 files changed, 51 insertions, 0 deletions
diff --git a/dev-python/jsonpickle/files/jsonpickle-1.4.1-importlib-metadata.patch b/dev-python/jsonpickle/files/jsonpickle-1.4.1-importlib-metadata.patch
new file mode 100644
index 000000000000..eefb41d73d7c
--- /dev/null
+++ b/dev-python/jsonpickle/files/jsonpickle-1.4.1-importlib-metadata.patch
@@ -0,0 +1,44 @@
+From 7e5752de7d49f222cec5107aa5044fa8f8ffbb39 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Wed, 22 Apr 2020 20:38:28 +0200
+Subject: [PATCH] Use importlib.metadata from the standard library on Python
+ 3.8+
+
+Fixes https://github.com/jsonpickle/jsonpickle/issues/303
+---
+ jsonpickle/version.py | 7 ++++++-
+ setup.cfg | 2 +-
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/jsonpickle/version.py b/jsonpickle/version.py
+index 01c83c4..92b44b2 100644
+--- a/jsonpickle/version.py
++++ b/jsonpickle/version.py
+@@ -1,5 +1,10 @@
++import sys
++
+ try:
+- import importlib_metadata as metadata
++ if sys.version_info < (3, 8):
++ import importlib_metadata as metadata
++ else:
++ from importlib import metadata
+ except (ImportError, OSError):
+ metadata = None
+
+diff --git a/setup.cfg b/setup.cfg
+index 9f0eab2..46707ec 100644
+--- a/setup.cfg
++++ b/setup.cfg
+@@ -36,7 +36,7 @@ packages = find:
+ include_package_data = true
+ python_requires = >=2.7
+ install_requires =
+- importlib_metadata
++ importlib_metadata; python_version<"3.8"
+ setup_requires = setuptools_scm[toml] >= 3.4.1
+
+ [options.extras_require]
+--
+2.28.0
+
diff --git a/dev-python/jsonpickle/jsonpickle-1.4.1-r1.ebuild b/dev-python/jsonpickle/jsonpickle-1.4.1-r2.ebuild
index c990ed01191f..752307b9830b 100644
--- a/dev-python/jsonpickle/jsonpickle-1.4.1-r1.ebuild
+++ b/dev-python/jsonpickle/jsonpickle-1.4.1-r2.ebuild
@@ -23,6 +23,9 @@ RDEPEND="
dev-python/simplejson[${PYTHON_USEDEP}]
dev-python/feedparser[${PYTHON_USEDEP}]
dev-python/ujson[${PYTHON_USEDEP}]
+ $(python_gen_cond_dep '
+ dev-python/importlib_metadata[${PYTHON_USEDEP}]
+ ' python3_{6,7})
"
# toml via setuptools_scm[toml]
BDEPEND="
@@ -32,6 +35,10 @@ BDEPEND="
distutils_enable_sphinx "docs/source"
distutils_enable_tests pytest
+PATCHES=(
+ "${FILESDIR}"/jsonpickle-1.4.1-importlib-metadata.patch
+)
+
python_prepare_all() {
# too many dependencies
rm tests/pandas_test.py || die