commit: fb89b4e2acc3c63b7b118c168dd5d779b60f7a72 Author: Huang Rui <vowstar <AT> gmail <DOT> com> AuthorDate: Tue May 6 09:00:00 2025 +0000 Commit: Petr Vaněk <arkamar <AT> gentoo <DOT> org> CommitDate: Thu May 8 11:40:38 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb89b4e2
dev-libs/json-parser: fix bug 954840 and 955499 Closes: https://bugs.gentoo.org/954840 Closes: https://bugs.gentoo.org/955499 Signed-off-by: Huang Rui <vowstar <AT> gmail.com> Upstream-PR: https://github.com/json-parser/json-parser/pull/182 Closes: https://github.com/gentoo/gentoo/pull/41956 Signed-off-by: Petr Vaněk <arkamar <AT> gentoo.org> .../json-parser-1.1.0-fix-suspicious-version.patch | 31 +++++++++++++++++ .../files/json-parser-1.1.0-python3-pylong.patch | 40 ++++++++++++++++++++++ .../json-parser/json-parser-1.1.0_p20211208.ebuild | 10 ++++-- 3 files changed, 78 insertions(+), 3 deletions(-) diff --git a/dev-libs/json-parser/files/json-parser-1.1.0-fix-suspicious-version.patch b/dev-libs/json-parser/files/json-parser-1.1.0-fix-suspicious-version.patch new file mode 100644 index 000000000000..9c65ebe66f61 --- /dev/null +++ b/dev-libs/json-parser/files/json-parser-1.1.0-fix-suspicious-version.patch @@ -0,0 +1,31 @@ +From f9b99a73ca108e4073b4fe501a3426dd4e21bba6 Mon Sep 17 00:00:00 2001 +From: Huang Rui <[email protected]> +Date: Tue, 6 May 2025 16:38:59 +0800 +Subject: [PATCH] build(python): Update package name and add version in + setup.py + +- Change package name to use hyphens instead of spaces +- Add version 1.1.0 to setup configuration + +Signed-off-by: Huang Rui <[email protected]> +--- + bindings/python/setup.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/bindings/python/setup.py b/bindings/python/setup.py +index 57be7d584d5a..cac13595eec9 100644 +--- a/bindings/python/setup.py ++++ b/bindings/python/setup.py +@@ -8,7 +8,8 @@ ext_modules.append(Extension('jsonparser', + + + setup( +- name = 'json-parser python wrapper', ++ name = 'json-parser-python-wrapper', ++ version = '1.1.0', + cmdclass = {'build_ext': build_ext}, + ext_modules = ext_modules + ) +-- +2.49.0 + diff --git a/dev-libs/json-parser/files/json-parser-1.1.0-python3-pylong.patch b/dev-libs/json-parser/files/json-parser-1.1.0-python3-pylong.patch new file mode 100644 index 000000000000..858afa485a69 --- /dev/null +++ b/dev-libs/json-parser/files/json-parser-1.1.0-python3-pylong.patch @@ -0,0 +1,40 @@ +From 5bd7dc824bcffd867edef7ef80cc896c8c51ce38 Mon Sep 17 00:00:00 2001 +From: Huang Rui <[email protected]> +Date: Tue, 6 May 2025 16:17:53 +0800 +Subject: [PATCH] fix(python): Add Python 3 compatibility macros for PyInt + functions + +- Add PY_MAJOR_VERSION check to define PyInt_* macros for Python 3 +- Replace deprecated PyInt functions with PyLong equivalents in Python 3 + +Signed-off-by: Huang Rui <[email protected]> +--- + bindings/python/wrap_json.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/bindings/python/wrap_json.c b/bindings/python/wrap_json.c +index bd0360512fd3..1d42a82aad77 100644 +--- a/bindings/python/wrap_json.c ++++ b/bindings/python/wrap_json.c +@@ -27,6 +27,18 @@ + + #include "../../json.c" + ++#include <Python.h> ++ ++#if PY_MAJOR_VERSION >= 3 ++ /* Define PyInt_* only for Python 3, where they no longer exist */ ++ #ifndef PyInt_FromLong ++ #define PyInt_FromLong PyLong_FromLong ++ #endif ++ #ifndef PyInt_AsLong ++ #define PyInt_AsLong PyLong_AsLong ++ #endif ++#endif ++ + PyObject * json_exception = PyErr_NewException("jsonparser.JSONException", + NULL, NULL); + +-- +2.49.0 + diff --git a/dev-libs/json-parser/json-parser-1.1.0_p20211208.ebuild b/dev-libs/json-parser/json-parser-1.1.0_p20211208.ebuild index 184acdce391c..f5f622296c05 100644 --- a/dev-libs/json-parser/json-parser-1.1.0_p20211208.ebuild +++ b/dev-libs/json-parser/json-parser-1.1.0_p20211208.ebuild @@ -1,4 +1,4 @@ -# Copyright 2022-2024 Gentoo Authors +# Copyright 2022-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -6,7 +6,7 @@ EAPI=8 DISTUTILS_EXT=1 DISTUTILS_OPTIONAL=1 DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{10..13} ) +PYTHON_COMPAT=( python3_{11..13} ) inherit distutils-r1 edo toolchain-funcs @@ -35,7 +35,11 @@ BDEPEND=" ) " -PATCHES=( "${FILESDIR}/${PN}-1.1.0-pkgconfig-libdir.patch" ) +PATCHES=( + "${FILESDIR}/${PN}-1.1.0-pkgconfig-libdir.patch" + "${FILESDIR}/${PN}-1.1.0-python3-pylong.patch" + "${FILESDIR}/${PN}-1.1.0-fix-suspicious-version.patch" +) wrap_python() { local phase=$1
