commit:     7f984b7279cc1d775e9b8c55d7290d1ed8d1119b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 25 14:06:50 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Oct 25 14:15:46 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f984b72

dev-python/rdflib: Bump to 7.1.0

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/rdflib/Manifest                         |  1 +
 .../files/rdflib-7.1.0-py3_13-fix-pickler.diff     | 63 +++++++++++++++++++
 dev-python/rdflib/rdflib-7.1.0.ebuild              | 70 ++++++++++++++++++++++
 3 files changed, 134 insertions(+)

diff --git a/dev-python/rdflib/Manifest b/dev-python/rdflib/Manifest
index 9d949ab73ce4..c744ec49e63a 100644
--- a/dev-python/rdflib/Manifest
+++ b/dev-python/rdflib/Manifest
@@ -1 +1,2 @@
 DIST rdflib-7.0.0.tar.gz 4765796 BLAKE2B 
60ca36160f4f6588892853adde9dd4b795e549cc7fd52127cf1e50de3853b25b3a333cabd584ccf22827cb6f89d215d225c4ba767d0775feeefb481e4b1ed93b
 SHA512 
56d110ab24c74c6ddb2e75320f60a82b4945e6ea1ce9d10ad4ae53d44c679b35826e3d7406e7d0e321ef9b042d32d2ba327a6dbd5c2c1780f552131d80c09445
+DIST rdflib-7.1.0.tar.gz 4863439 BLAKE2B 
0f06d272a6b8b0d9356fe8fd67e9df5c1ceb0d9e102a9e954edc17ee3633f45e61520a9db3598777420f501dbb9e63085249211466fc8412d23986ee2b585c7e
 SHA512 
40a3afba52161c2e642a0770d88b08d5bfd6d84325757cef13ad5dc620bcc7f13395c4a51e32b44db56b54568893af44f51b723ceebae1cc089e99b7e0e93c25

diff --git a/dev-python/rdflib/files/rdflib-7.1.0-py3_13-fix-pickler.diff 
b/dev-python/rdflib/files/rdflib-7.1.0-py3_13-fix-pickler.diff
new file mode 100644
index 000000000000..b992bec0a011
--- /dev/null
+++ b/dev-python/rdflib/files/rdflib-7.1.0-py3_13-fix-pickler.diff
@@ -0,0 +1,63 @@
+--- a/rdflib/store.py
++++ b/rdflib/store.py
+@@ -114,26 +114,38 @@ class TripleRemovedEvent(Event):
+ 
+ 
++class _Pickler(Pickler):
++    def __init__(self, file, node):
++        super(_Pickler, self).__init__(file)
++        self._node = node
++
++    def persistent_id(self, key: Any) -> Optional[str]:
++        try:
++            return self._node._ids.get(key)
++        except TypeError:
++            return None
++
++
++class _Unpickler(Unpickler):
++    def __init__(self, file, node):
++        super(_Unpickler, self).__init__(file)
++        self._node = node
++
++    def persistent_load(self, pid):
++        return self._node._get_object(pid)
++
++
+ class NodePickler:
+     def __init__(self) -> None:
+         self._objects: Dict[str, Any] = {}
+         self._ids: Dict[Any, str] = {}
+         self._get_object = self._objects.__getitem__
+ 
+-    def _get_ids(self, key: Any) -> Optional[str]:
+-        try:
+-            return self._ids.get(key)
+-        except TypeError:
+-            return None
+-
+     def register(self, object: Any, id: str) -> None:
+         self._objects[id] = object
+         self._ids[object] = id
+ 
+     def loads(self, s: bytes) -> Node:
+-        up = Unpickler(BytesIO(s))
+-        # NOTE on type error: https://github.com/python/mypy/issues/2427
+-        # type error: Cannot assign to a method
+-        up.persistent_load = self._get_object  # type: ignore[assignment]
++        up = _Unpickler(BytesIO(s), self)
+         try:
+             return up.load()
+         except KeyError as e:
+@@ -143,10 +155,7 @@ class NodePickler:
+         self, obj: "Node", protocol: Optional[Any] = None, bin: Optional[Any] 
= None
+     ):
+         src = BytesIO()
+-        p = Pickler(src)
+-        # NOTE on type error: https://github.com/python/mypy/issues/2427
+-        # type error: Cannot assign to a method
+-        p.persistent_id = self._get_ids  # type: ignore[assignment]
++        p = _Pickler(src, self)
+         p.dump(obj)
+         return src.getvalue()
+ 

diff --git a/dev-python/rdflib/rdflib-7.1.0.ebuild 
b/dev-python/rdflib/rdflib-7.1.0.ebuild
new file mode 100644
index 000000000000..045fd23592a0
--- /dev/null
+++ b/dev-python/rdflib/rdflib-7.1.0.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=poetry
+PYTHON_COMPAT=( python3_{10..13} )
+PYTHON_REQ_USE="sqlite?,threads(+)"
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="RDF library containing a triple store and parser/serializer"
+HOMEPAGE="
+       https://github.com/RDFLib/rdflib/
+       https://pypi.org/project/rdflib/
+"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~sparc ~x86"
+IUSE="examples sqlite"
+
+RDEPEND="
+       <dev-python/isodate-1[${PYTHON_USEDEP}]
+       >=dev-python/isodate-0.7.2[${PYTHON_USEDEP}]
+       dev-python/html5lib[${PYTHON_USEDEP}]
+       <dev-python/pyparsing-4[${PYTHON_USEDEP}]
+       >=dev-python/pyparsing-2.1.0[${PYTHON_USEDEP}]
+"
+BDEPEND="
+       test? (
+               dev-python/requests[${PYTHON_USEDEP}]
+       )
+"
+
+PATCHES=(
+       # 
https://src.fedoraproject.org/fork/salimma/rpms/python-rdflib/blob/d2fbf492897262350bd569f1566b97a54e092cd9/f/rdflib-py3_13-fix-pickler.diff
+       "${FILESDIR}/${PN}-7.1.0-py3_13-fix-pickler.diff"
+)
+
+distutils_enable_tests pytest
+
+python_prepare_all() {
+       distutils-r1_python_prepare_all
+
+       # doctests require internet
+       sed -i -e '/doctest-modules/d' pyproject.toml || die
+
+       # we disable pytest-cov
+       sed -i -e 's@, no_cover: None@@' test/test_misc/test_plugins.py || die
+
+       # allow regular html5lib, html5lib-modern has no real changes
+       sed -e 's:html5lib-modern:html5lib:' \
+               -e '/html5lib/s:1\.2:1.1:' \
+               -i pyproject.toml || die
+}
+
+python_test() {
+       local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+       epytest -m "not webtest"
+}
+
+python_install_all() {
+       distutils-r1_python_install_all
+
+       if use examples; then
+               dodoc -r examples
+               docompress -x /usr/share/doc/${PF}/examples
+       fi
+}

Reply via email to