diff options
Diffstat (limited to 'dev-python/rdflib')
-rw-r--r-- | dev-python/rdflib/Manifest | 2 | ||||
-rw-r--r-- | dev-python/rdflib/files/rdflib-7.0.0-py3_13-fix-pickler.diff | 64 | ||||
-rw-r--r-- | dev-python/rdflib/rdflib-7.0.0-r1.ebuild | 65 |
3 files changed, 131 insertions, 0 deletions
diff --git a/dev-python/rdflib/Manifest b/dev-python/rdflib/Manifest index 75e353dbb57b..3724f570ae01 100644 --- a/dev-python/rdflib/Manifest +++ b/dev-python/rdflib/Manifest @@ -1,3 +1,5 @@ +AUX rdflib-7.0.0-py3_13-fix-pickler.diff 1986 BLAKE2B 6ba02b7b5efa73e09ea3535d834162000f7a28f8d0d1a29db41c58594fea4d777ad9631d45aecfae9559fbfdf1e6edd81eedf9d4344661bc0af1246d2c2c91d0 SHA512 b87c5e938c33afd57a561c6d27eb31121f57c64425178e31b64f33e737ce877ede748d485f8f6dfafc1dd96e296d86ca6218176921a258c1fbe810a81e5685da DIST rdflib-7.0.0.tar.gz 4765796 BLAKE2B 60ca36160f4f6588892853adde9dd4b795e549cc7fd52127cf1e50de3853b25b3a333cabd584ccf22827cb6f89d215d225c4ba767d0775feeefb481e4b1ed93b SHA512 56d110ab24c74c6ddb2e75320f60a82b4945e6ea1ce9d10ad4ae53d44c679b35826e3d7406e7d0e321ef9b042d32d2ba327a6dbd5c2c1780f552131d80c09445 +EBUILD rdflib-7.0.0-r1.ebuild 1538 BLAKE2B f80d9cbb654558ba80f192f211fa569aa7eeb1f9ea38deeff22ab0b7bf90ab3dc1877f2e512f78f54210705d15f6358d9be0f21c70d1b641ac31e323f22cf17f SHA512 ee21cf302451ab883025acd076483761e206caa82663d14d8c23ae0af0b89d8750e3a49a71c1aa6d5b1cd6a823bfe4a54240f84e5c67a2794b1ac29e4f9add67 EBUILD rdflib-7.0.0.ebuild 1330 BLAKE2B a79dfecfd52ebcd660f129fb316d0b238c00316d169576ba4f6aaa1c6e651f604b377551608a7d11d1b3891942cd85edbf93248c72fae772ab1e12e11ccdda33 SHA512 ad12131a19cfa729ca8b52251c1843f34b056fca6bdf4edb49414cd3f0788b16c5b8de9d54d7c4bf098734a747ad4e96fd4a14322a02de38ef1cf8fd8f198004 MISC metadata.xml 400 BLAKE2B eea3d3a69375a70a1c4a93cebf48169032f9d7cc6ba5df0422bad8c0f4e1caa10721a42b66cfb0dad2ab85aff38f826a0790b4d2dbac90be16e88ecf507d9025 SHA512 d8b94c9c8c037f40db80a44d235ada552851c3b979f496462e19a909eb2b46f606c23458b20869060b596969015616d065b2df0f5b24d2b3d7224afa6089e8e7 diff --git a/dev-python/rdflib/files/rdflib-7.0.0-py3_13-fix-pickler.diff b/dev-python/rdflib/files/rdflib-7.0.0-py3_13-fix-pickler.diff new file mode 100644 index 000000000000..d2fbf4928972 --- /dev/null +++ b/dev-python/rdflib/files/rdflib-7.0.0-py3_13-fix-pickler.diff @@ -0,0 +1,64 @@ +--- a/rdflib/store.py ++++ b/rdflib/store.py +@@ -113,27 +113,39 @@ 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.0.0-r1.ebuild b/dev-python/rdflib/rdflib-7.0.0-r1.ebuild new file mode 100644 index 000000000000..445cb67889d4 --- /dev/null +++ b/dev-python/rdflib/rdflib-7.0.0-r1.ebuild @@ -0,0 +1,65 @@ +# 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.6.0[${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.0.0-py3_13-fix-pickler.diff" +) + +distutils_enable_tests pytest + +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 + + distutils-r1_python_prepare_all +} + +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 +} |