commit:     40ad81d7e803706b0d6652be0cd4948b080f72d0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun May 25 06:12:11 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun May 25 07:32:22 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40ad81d7

app-i18n/nkf: enable py3.13, py3.14; update python-nkf version; wire up python 
tests

Closes: https://bugs.gentoo.org/952210
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-i18n/nkf/Manifest                     |   1 +
 app-i18n/nkf/files/nkf-2.1.5-python.patch |  15 ++++
 app-i18n/nkf/nkf-2.1.5-r2.ebuild          | 126 ++++++++++++++++++++++++++++++
 3 files changed, 142 insertions(+)

diff --git a/app-i18n/nkf/Manifest b/app-i18n/nkf/Manifest
index 498f30cb2ae1..d9e7d6409de6 100644
--- a/app-i18n/nkf/Manifest
+++ b/app-i18n/nkf/Manifest
@@ -1,2 +1,3 @@
 DIST nkf-2.1.5.tar.gz 215879 BLAKE2B 
b5ae8f51b0ed97261f9e82ad469adbc9e469e709dc5acb64bfba48881555931eade5fcb772e7956a7401399008ec33bd57c8d6d8b5790eefe4d69d4e1dabed7c
 SHA512 
fa5b683184481b25249872e7902033a72b6a6219b4c63d508a738710029430733e78cfa13b3d69dc281676762765e0452c92244a3855d3acbb5e23aa63214847
 DIST python-nkf-0.2.0_p20191121.tar.gz 188496 BLAKE2B 
f7c9baaff8129956b7981011634f7ee5ece97e1b6650551a5cc2b50ff51a0c96a454f39e888c80120242a12b202c0422c0ecfc21858b1822a4959ff4c108b10d
 SHA512 
ae1494ebdd488dc40802178a1b7b05c9a9b0bcf9cf9fa5017c6bc9f153c01b475c00f993489a21f643acc4ad61595c38c5afe28f3512a4d24f36eda7abd33958
+DIST python-nkf-1.0.4.tar.gz 187955 BLAKE2B 
cb1f61d01071d66f127c21a5f2f0040a7291ee4e23dbcd21c65b8252ac3585932ecf354d17310021eb8526f3faf1ae2826b0e3373234042c53e130c19b25c429
 SHA512 
be9153a9d2053404020407e3ea710ec1cbf05c1b3bba5eb121756b995dc78b37366aa70cf8a0775fa459226410eb1b4331fa563465f0c93297604cb0cde88b8c

diff --git a/app-i18n/nkf/files/nkf-2.1.5-python.patch 
b/app-i18n/nkf/files/nkf-2.1.5-python.patch
new file mode 100644
index 000000000000..4c8e3c7d7702
--- /dev/null
+++ b/app-i18n/nkf/files/nkf-2.1.5-python.patch
@@ -0,0 +1,15 @@
+diff --git a/NKF.python/ext/NKF_python.c b/NKF.python/ext/NKF_python.c
+index b17229e..7c98c2e 100644
+--- a/NKF.python/ext/NKF_python.c
++++ b/NKF.python/ext/NKF_python.c
+@@ -80,8 +80,8 @@ pynkf_putchar(int c)
+ }
+ 
+ #define PERL_XS 1
+-#include "nkf/utf8tbl.c"
+-#include "nkf/nkf.c"
++#include "../../utf8tbl.c"
++#include "../../nkf.c"
+ 
+ static PyObject *
+ pynkf_convert(unsigned char* str, Py_ssize_t strlen, char* opts, Py_ssize_t 
optslen)

diff --git a/app-i18n/nkf/nkf-2.1.5-r2.ebuild b/app-i18n/nkf/nkf-2.1.5-r2.ebuild
new file mode 100644
index 000000000000..115fe8deeedc
--- /dev/null
+++ b/app-i18n/nkf/nkf-2.1.5-r2.ebuild
@@ -0,0 +1,126 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..14} )
+DISTUTILS_USE_PEP517=pdm-backend
+DISTUTILS_OPTIONAL=1
+DISTUTILS_EXT=1
+
+inherit distutils-r1 perl-module toolchain-funcs vcs-snapshot
+
+PY_P="python-${PN}-1.0.4"
+PY_COMMIT="6dcc796ce4fc0123fc1f7377583c56be8ff29a81"
+
+DESCRIPTION="Network Kanji code conversion Filter with UTF-8/16 support"
+HOMEPAGE="https://osdn.net/projects/nkf/";
+SRC_URI="
+       mirror://sourceforge.jp/${PN}/70406/${P}.tar.gz
+       python? ( 
https://github.com/fumiyas/python-${PN}/archive/${PY_COMMIT}.tar.gz -> 
${PY_P}.tar.gz )
+"
+
+LICENSE="ZLIB python? ( BSD )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
+IUSE="perl python l10n_ja"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       python? (
+               ${PYTHON_DEPS}
+               ${DISTUTILS_DEPS}
+       )
+"
+
+distutils_enable_tests pytest
+
+src_unpack() {
+       use python && vcs-snapshot_src_unpack || default
+}
+
+src_prepare() {
+       sed -i \
+               -e "/^CFLAGS/{ s/-g -O2//; s/=/+=/; }" \
+               -e "/ -o ${PN}/s/\(-o \)/\$(LDFLAGS) \1/" \
+               Makefile || die
+       if use python; then
+               mv "${WORKDIR}"/${PY_P} NKF.python || die
+
+               eapply "${FILESDIR}"/${P}-python.patch
+
+               cd NKF.python || die
+               distutils-r1_src_prepare
+               cd - >/dev/null || die
+       fi
+       default
+}
+
+src_configure() {
+       default
+       if use perl; then
+               cd NKF.mod || die
+               perl-module_src_configure
+               cd - >/dev/null || die
+       fi
+       if use python; then
+               cd NKF.python || die
+               distutils-r1_src_configure
+               cd - >/dev/null || die
+       fi
+}
+
+src_compile() {
+       emake CC="$(tc-getCC)"
+       if use perl; then
+               cd NKF.mod || die
+               perl-module_src_compile
+               cd - >/dev/null || die
+       fi
+       if use python; then
+               cd NKF.python || die
+               distutils-r1_src_compile
+               cd - >/dev/null || die
+       fi
+}
+
+src_test() {
+       default
+       if use perl; then
+               cd NKF.mod || die
+               perl-module_src_test
+               cd - >/dev/null || die
+       fi
+       if use python; then
+               cd NKF.python || die
+               distutils-r1_src_test
+               cd - >/dev/null || die
+       fi
+}
+
+src_install() {
+       dobin ${PN}
+       doman ${PN}.1
+
+       if use l10n_ja; then
+               iconv -f ISO-2022-JP-3 -t UTF-8 ${PN}.1j > ${PN}.ja.1 || die
+               doman ${PN}.ja.1
+       fi
+       dodoc ${PN}.doc
+
+       if use perl; then
+               cd NKF.mod || die
+               docinto perl
+               perl-module_src_install
+               cd - >/dev/null || die
+       fi
+       if use python; then
+               cd NKF.python || die
+               docinto python
+               DOCS= distutils-r1_src_install
+               dodoc CHANGES README.md
+               cd - >/dev/null || die
+       fi
+}

Reply via email to