commit:     da9e3c2f86d7fbf872cffec0d8caa808e6bff9c7
Author:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 29 07:57:18 2024 +0000
Commit:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
CommitDate: Fri Nov 29 21:12:14 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da9e3c2f

dev-python/pykakasi: new package, add 2.3.0

Needed for calibre.

Signed-off-by: Eli Schwartz <eschwartz <AT> gentoo.org>

 dev-python/pykakasi/Manifest                       |  1 +
 .../files/0001-fix-update-test-expectation.patch   | 24 +++++++++++
 .../0001-tests-make-benchmarking-optional.patch    | 50 ++++++++++++++++++++++
 dev-python/pykakasi/metadata.xml                   | 16 +++++++
 dev-python/pykakasi/pykakasi-2.3.0.ebuild          | 41 ++++++++++++++++++
 5 files changed, 132 insertions(+)

diff --git a/dev-python/pykakasi/Manifest b/dev-python/pykakasi/Manifest
new file mode 100644
index 000000000000..0156094af199
--- /dev/null
+++ b/dev-python/pykakasi/Manifest
@@ -0,0 +1 @@
+DIST pykakasi-2.3.0.tar.gz 21752447 BLAKE2B 
84bf946beebd6bbd156970b8f6610aacab2305dc3ace6798464a64f22a007bbe8a4fb76b43788638095ef5babbf9ac48ac9d1887e8e0a5859fc9dcb579e00281
 SHA512 
f1160a99b9d20d2e67aae265ca039c67d1ca3878703b10ff6cc559924094944ef01ca107ff7ad0e0c051080d337660eedbe52ac786eb12b01dfd80e06aa473b8

diff --git a/dev-python/pykakasi/files/0001-fix-update-test-expectation.patch 
b/dev-python/pykakasi/files/0001-fix-update-test-expectation.patch
new file mode 100644
index 000000000000..8d073039a5b1
--- /dev/null
+++ b/dev-python/pykakasi/files/0001-fix-update-test-expectation.patch
@@ -0,0 +1,24 @@
+From c27fa6eb714af6e34e302e479456f1cc68529f46 Mon Sep 17 00:00:00 2001
+From: Hiroshi Miura <miur...@linux.com>
+Date: Mon, 24 Jun 2024 19:02:45 +0900
+Subject: [PATCH] fix: update test expectation
+
+- fix punctuation
+---
+ tests/test_pykakasi_structured.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test_pykakasi_structured.py 
b/tests/test_pykakasi_structured.py
+index 83b3be0..c7ba3bb 100644
+--- a/tests/test_pykakasi_structured.py
++++ b/tests/test_pykakasi_structured.py
+@@ -666,4 +666,5 @@ def test_aozora():
+     assert result[7]['kana'] == 'カラ'
+     assert result[8]['kana'] == 'タイグウ'
+     assert result[9]['kana'] == 'サレテ'
+-    assert result[10]['kana'] == 'イル。'
++    assert result[10]['kana'] == 'イル'
++    assert result[11]['kana'] == '。'
+-- 
+2.45.2
+

diff --git 
a/dev-python/pykakasi/files/0001-tests-make-benchmarking-optional.patch 
b/dev-python/pykakasi/files/0001-tests-make-benchmarking-optional.patch
new file mode 100644
index 000000000000..3b2095ccc8a0
--- /dev/null
+++ b/dev-python/pykakasi/files/0001-tests-make-benchmarking-optional.patch
@@ -0,0 +1,50 @@
+From e51d045f6bc2d70538c24a9997ca90500019d567 Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <eschwa...@gentoo.org>
+Date: Fri, 29 Nov 2024 00:42:32 -0500
+Subject: [PATCH] tests: make benchmarking optional
+
+It can be disabled by running `pytest -m 'not benchmark'`. In this case,
+we don't need pytest-benchmark or py-cpuinfo installed.
+
+To make this work, we need to tell pytest that the benchmarking hooks in
+conftest.py are optional, and only needed when a particular plugin is
+installed.
+
+Signed-off-by: Eli Schwartz <eschwa...@gentoo.org>
+---
+ tests/conftest.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tests/conftest.py b/tests/conftest.py
+index 524b813..374899d 100644
+--- a/tests/conftest.py
++++ b/tests/conftest.py
+@@ -1,7 +1,6 @@
+ import os
+ import sys
+ 
+-import cpuinfo
+ import pytest
+ 
+ import kakasidict
+@@ -18,6 +17,7 @@ def dictionary_setup_fixture():
+     Configurations.data_path = dpath
+ 
+ 
++@pytest.hookimpl(optionalhook=True)
+ def pytest_benchmark_update_json(config, benchmarks, output_json):
+     """Calculate speed and add as extra_info"""
+     for benchmark in output_json["benchmarks"]:
+@@ -26,7 +26,9 @@ def pytest_benchmark_update_json(config, benchmarks, 
output_json):
+             benchmark["extra_info"]["rate"] = rate
+ 
+ 
++@pytest.hookimpl(optionalhook=True)
+ def pytest_benchmark_update_machine_info(config, machine_info):
++    import cpuinfo
+     cpu_info = cpuinfo.get_cpu_info()
+     brand = cpu_info.get("brand_raw", None)
+     if brand is None:
+-- 
+2.45.2
+

diff --git a/dev-python/pykakasi/metadata.xml b/dev-python/pykakasi/metadata.xml
new file mode 100644
index 000000000000..4fd6f2f1d995
--- /dev/null
+++ b/dev-python/pykakasi/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>eschwa...@gentoo.org</email>
+               <name>Eli Schwartz</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>pyt...@gentoo.org</email>
+               <name>Python</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="pypi">pykakasi</remote-id>
+               <remote-id type="codeberg">miurahr/pykakasi</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/dev-python/pykakasi/pykakasi-2.3.0.ebuild 
b/dev-python/pykakasi/pykakasi-2.3.0.ebuild
new file mode 100644
index 000000000000..dc3958635fc6
--- /dev/null
+++ b/dev-python/pykakasi/pykakasi-2.3.0.ebuild
@@ -0,0 +1,41 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..13} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="Kana kanji simple inversion library"
+HOMEPAGE="
+       https://pypi.org/project/pykakasi/
+       https://codeberg.org/miurahr/pykakasi
+"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="
+       dev-python/deprecated[${PYTHON_USEDEP}]
+       dev-python/jaconv[${PYTHON_USEDEP}]
+"
+BDEPEND="
+       dev-python/setuptools-scm[${PYTHON_USEDEP}]
+"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+       # https://codeberg.org/miurahr/pykakasi/pulls/175
+       # Avoids several pointless, unpackaged test deps
+       "${FILESDIR}"/0001-tests-make-benchmarking-optional.patch
+       # released with a failing test and immediately fixed after...
+       "${FILESDIR}"/0001-fix-update-test-expectation.patch
+)
+
+python_test() {
+       epytest -m 'not benchmark'
+}

Reply via email to