summaryrefslogtreecommitdiff
path: root/dev-python/py-ubjson
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/py-ubjson')
-rw-r--r--dev-python/py-ubjson/Manifest1
-rw-r--r--dev-python/py-ubjson/files/py-ubjson-0.16.1-py312.patch35
-rw-r--r--dev-python/py-ubjson/metadata.xml19
-rw-r--r--dev-python/py-ubjson/py-ubjson-0.16.1-r1.ebuild39
4 files changed, 94 insertions, 0 deletions
diff --git a/dev-python/py-ubjson/Manifest b/dev-python/py-ubjson/Manifest
new file mode 100644
index 000000000000..07d5c996c055
--- /dev/null
+++ b/dev-python/py-ubjson/Manifest
@@ -0,0 +1 @@
+DIST py-ubjson-0.16.1.tar.gz 50316 BLAKE2B 442894a7c010d1ba4a836827ca17e7cb10b34a6f5488851ce13a3c3ab02d8173250a664da4504bca9fd2d9377631e249127c789a4824930f8b35db2225902e9d SHA512 5c5e48fa236571832fbcd100ebe0efd7522a8f5773b74475e7b102fadc4e2917549640d12c5afb2aadbe65a6973b75540681da1df8febbf47f84844bc9337fb0
diff --git a/dev-python/py-ubjson/files/py-ubjson-0.16.1-py312.patch b/dev-python/py-ubjson/files/py-ubjson-0.16.1-py312.patch
new file mode 100644
index 000000000000..ab2bb2cab503
--- /dev/null
+++ b/dev-python/py-ubjson/files/py-ubjson-0.16.1-py312.patch
@@ -0,0 +1,35 @@
+From 1e69041e86947e360f30b8ee5ee0993ddd68469c Mon Sep 17 00:00:00 2001
+From: Vilnis Termanis <vilnis.termanis@iotics.com>
+Date: Fri, 20 Oct 2023 17:10:10 +0200
+Subject: [PATCH] Fix recursion test case for Python 3.12
+
+---
+ test/test.py | 6 +++---
+ 3 files changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/test/test.py b/test/test.py
+index c3920c4..d685194 100644
+--- a/test/test.py
++++ b/test/test.py
+@@ -465,10 +465,10 @@ def assert_raises_regex(self, *args, **kwargs):
+
+ def test_recursion(self):
+ old_limit = getrecursionlimit()
+- setrecursionlimit(200)
++ setrecursionlimit(100)
+ try:
+ obj = current = []
+- for _ in range(getrecursionlimit() * 2):
++ for _ in range(getrecursionlimit() * 30):
+ new_list = []
+ current.append(new_list)
+ current = new_list
+@@ -476,7 +476,7 @@ def test_recursion(self):
+ with self.assert_raises_regex(RuntimeError, 'recursion'):
+ self.ubjdumpb(obj)
+
+- raw = ARRAY_START * (getrecursionlimit() * 2)
++ raw = ARRAY_START * (getrecursionlimit() * 30)
+ with self.assert_raises_regex(RuntimeError, 'recursion'):
+ self.ubjloadb(raw)
+ finally:
diff --git a/dev-python/py-ubjson/metadata.xml b/dev-python/py-ubjson/metadata.xml
new file mode 100644
index 000000000000..63a09ab615d0
--- /dev/null
+++ b/dev-python/py-ubjson/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <upstream>
+ <maintainer>
+ <email>vilnis.termanis@iotic-labs.com</email>
+ <name>Iotic Labs Ltd</name>
+ </maintainer>
+ </upstream>
+ <longdescription>
+ This is a Python v3.2+ (and 2.7+) Universal Binary JSON encoder/decoder
+ based on the draft-12 specification
+ </longdescription>
+ <origin>baldeagleos-repo</origin>
+</pkgmetadata>
diff --git a/dev-python/py-ubjson/py-ubjson-0.16.1-r1.ebuild b/dev-python/py-ubjson/py-ubjson-0.16.1-r1.ebuild
new file mode 100644
index 000000000000..916d8e0ada34
--- /dev/null
+++ b/dev-python/py-ubjson/py-ubjson-0.16.1-r1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=setuptools
+PYPI_NO_NORMALIZE=1
+PYTHON_COMPAT=( python3_{13..14} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="Universal Binary JSON encoder/decoder"
+HOMEPAGE="
+ https://github.com/Iotic-Labs/py-ubjson/
+ https://pypi.org/project/py-ubjson/
+"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="amd64 arm arm64 ~riscv ~sparc x86"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+ # https://github.com/Iotic-Labs/py-ubjson/pull/19
+ "${FILESDIR}/${P}-py312.patch"
+)
+
+python_test() {
+ local EPYTEST_DESELECT=(
+ # the usual problem with random packages increasing recursion limit
+ test/test.py::TestEncodeDecodePlainExt::test_recursion
+ test/test.py::TestEncodeDecodeFpExt::test_recursion
+ )
+
+ local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+ epytest test/test.py
+}