summaryrefslogtreecommitdiff
path: root/dev-python/jsonpickle
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-10-17 13:54:39 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-10-17 13:54:39 +0100
commitfe7238eca1d510cb096bf290978af72ba6607930 (patch)
tree564be9d3b7f3c9537d08b9b6a75fb119777c36f3 /dev-python/jsonpickle
parent403387a1bc2a2d98e75bf1474b21ae379b88aab2 (diff)
gentoo auto-resync : 17:10:2022 - 13:54:39
Diffstat (limited to 'dev-python/jsonpickle')
-rw-r--r--dev-python/jsonpickle/Manifest2
-rw-r--r--dev-python/jsonpickle/files/jsonpickle-2.2.0-python3.11.patch46
-rw-r--r--dev-python/jsonpickle/jsonpickle-2.2.0-r1.ebuild63
3 files changed, 111 insertions, 0 deletions
diff --git a/dev-python/jsonpickle/Manifest b/dev-python/jsonpickle/Manifest
index e2f525e22503..38d8118e2d19 100644
--- a/dev-python/jsonpickle/Manifest
+++ b/dev-python/jsonpickle/Manifest
@@ -1,3 +1,5 @@
+AUX jsonpickle-2.2.0-python3.11.patch 1832 BLAKE2B e21a31ea09dbcd3f6cf5ad4864f959f63d295215f1edf539181710877f6ff33a601c72bed832c58422eaeb96b8aa471479db8b61961cb3108b93306c2f0c416b SHA512 560f269a0e19a5e0881c8266fdacf7fb764eaa872c12740dc57d36240421e2aa645cac2d9b107f7dd62b870e1c6371defa3b37a0ec10353ddf53109d83031e89
DIST jsonpickle-2.2.0.tar.gz 189866 BLAKE2B d8fcd0e8b71947b734c59240d9fa4f0b35b9b0ac2e2940a9baf05c160771db0eae5f011b61e3b1c0bc746a740ac2e137a392931e270fea3acf4884578133283e SHA512 b6cb35316e32f38875cbfa3784a3930f669d4ea730ead6117242070590647987383e9f933c193b8c246c40dba87ad56600a65db89c45c18a790b3c1f9232b245
+EBUILD jsonpickle-2.2.0-r1.ebuild 1598 BLAKE2B 4b8a089d087f03dda6431ada4bafe89116713b25902574e22c051e5c759373edd68dd2c17b0165218d30ef5fcaf87ff718c18d81d10bd6fc5d03fb1d838ad639 SHA512 256711211274f77c6fa7e6da7194aebbfdb01f4a4f911b04cf6256139752bd8dbb5f3abbc4a82ccb29b2e26b526aa9d17f26870fd90b99154791a7246f686a89
EBUILD jsonpickle-2.2.0.ebuild 1493 BLAKE2B 828d3d7f8e8861bedbf785cac825d94adab19c9d90dbda5c3bbc9b97bfa2280ea9bc9e4892eb7471afad82cb8361560f6c728fe5b44dfcb4586ce9e919c48385 SHA512 18b35ac73f991cc1afc018863037f998575ae08e1cffe720ab225cdc0c7e7c0baee610038b1d497c89cdf07f2d681b2d005916e2cb00c9518981871e20159a67
MISC metadata.xml 412 BLAKE2B a7e746abd8b45415ecdbccbde1b65ba9f1fa9fe7ce353411681c2a3de046878e990aad20849ee561a56ad3208bd5071d7b5e5b3c767fd71b7c44d2e8412d349b SHA512 dc52df78fdfe9024e695aae3d2bf22bed7162e1f2a528a288056b68022ebbc400b0a3a2f3e9c2155ee57e66d77a4f7a3f6f67188fb13ee15f200212ac6809a31
diff --git a/dev-python/jsonpickle/files/jsonpickle-2.2.0-python3.11.patch b/dev-python/jsonpickle/files/jsonpickle-2.2.0-python3.11.patch
new file mode 100644
index 000000000000..10c266a2a696
--- /dev/null
+++ b/dev-python/jsonpickle/files/jsonpickle-2.2.0-python3.11.patch
@@ -0,0 +1,46 @@
+diff --git a/jsonpickle/pickler.py b/jsonpickle/pickler.py
+index 3d391cb..2103e46 100644
+--- a/jsonpickle/pickler.py
++++ b/jsonpickle/pickler.py
+@@ -476,8 +476,12 @@ def _flatten_obj_instance(self, obj):
+
+ # Support objects with __getstate__(); this ensures that
+ # both __setstate__() and __getstate__() are implemented
+- has_getstate = hasattr(obj, '__getstate__')
++ has_own_getstate = (
++ hasattr(type(obj), '__getstate__')
++ and type(obj).__getstate__ is not getattr(object, '__getstate__', None)
++ )
+ # not using has_method since __getstate__() is handled separately below
++ # Note: on Python 3.11+, all objects have __getstate__.
+
+ if has_class:
+ cls = obj.__class__
+@@ -549,7 +553,7 @@ def _flatten_obj_instance(self, obj):
+ # check that getstate/setstate is sane
+ if not (
+ state
+- and hasattr(obj, '__getstate__')
++ and has_own_getstate
+ and not hasattr(obj, '__setstate__')
+ and not isinstance(obj, dict)
+ ):
+@@ -581,7 +585,7 @@ def _flatten_obj_instance(self, obj):
+ if has_getinitargs:
+ data[tags.INITARGS] = self._flatten(obj.__getinitargs__())
+
+- if has_getstate:
++ if has_own_getstate:
+ try:
+ state = obj.__getstate__()
+ except TypeError:
+@@ -590,7 +594,8 @@ def _flatten_obj_instance(self, obj):
+ self._pickle_warning(obj)
+ return None
+ else:
+- return self._getstate(state, data)
++ if state:
++ return self._getstate(state, data)
+
+ if util.is_module(obj):
+ if self.unpicklable:
diff --git a/dev-python/jsonpickle/jsonpickle-2.2.0-r1.ebuild b/dev-python/jsonpickle/jsonpickle-2.2.0-r1.ebuild
new file mode 100644
index 000000000000..5d7a8f7f0267
--- /dev/null
+++ b/dev-python/jsonpickle/jsonpickle-2.2.0-r1.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{8..11} )
+
+inherit distutils-r1 optfeature
+
+DESCRIPTION="Python library for serializing any arbitrary object graph into JSON"
+HOMEPAGE="
+ https://github.com/jsonpickle/jsonpickle/
+ https://pypi.org/project/jsonpickle/
+"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux"
+
+BDEPEND="
+ dev-python/setuptools_scm[${PYTHON_USEDEP}]
+ test? (
+ dev-python/feedparser[${PYTHON_USEDEP}]
+ dev-python/numpy[${PYTHON_USEDEP}]
+ dev-python/pandas[${PYTHON_USEDEP}]
+ dev-python/simplejson[${PYTHON_USEDEP}]
+ dev-python/sqlalchemy[${PYTHON_USEDEP}]
+ dev-python/ujson[${PYTHON_USEDEP}]
+ )
+"
+
+PATCHES=(
+ # https://github.com/jsonpickle/jsonpickle/pull/396
+ "${FILESDIR}/${P}-python3.11.patch"
+)
+
+distutils_enable_tests pytest
+
+python_prepare_all() {
+ sed -i -e 's:--flake8 --cov::' pytest.ini || die
+ distutils-r1_python_prepare_all
+}
+
+python_test() {
+ local EPYTEST_IGNORE=(
+ # unpackaged bson dependency
+ tests/bson_test.py
+ # broken when gmpy is installed
+ # https://github.com/jsonpickle/jsonpickle/issues/328
+ # https://github.com/jsonpickle/jsonpickle/issues/316
+ tests/ecdsa_test.py
+ )
+ epytest
+}
+
+pkg_postinst() {
+ # Unpackaged optional backends: yajl, demjson
+ optfeature "encoding numpy-based data" dev-python/numpy
+ optfeature "encoding pandas objects" dev-python/pandas
+ optfeature "fast JSON backend" dev-python/simplejson
+}