dev-python/pykakasi: new package, add 2.3.0

Needed for calibre.

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
This commit is contained in:
Eli Schwartz 2024-11-29 02:57:18 -05:00
parent e31e5058b2
commit da9e3c2f86
No known key found for this signature in database
GPG Key ID: 84A7D12B700D2F57
5 changed files with 132 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST pykakasi-2.3.0.tar.gz 21752447 BLAKE2B 84bf946beebd6bbd156970b8f6610aacab2305dc3ace6798464a64f22a007bbe8a4fb76b43788638095ef5babbf9ac48ac9d1887e8e0a5859fc9dcb579e00281 SHA512 f1160a99b9d20d2e67aae265ca039c67d1ca3878703b10ff6cc559924094944ef01ca107ff7ad0e0c051080d337660eedbe52ac786eb12b01dfd80e06aa473b8

View File

@ -0,0 +1,24 @@
From c27fa6eb714af6e34e302e479456f1cc68529f46 Mon Sep 17 00:00:00 2001
From: Hiroshi Miura <miurahr@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

View File

@ -0,0 +1,50 @@
From e51d045f6bc2d70538c24a9997ca90500019d567 Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz@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 <eschwartz@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

View File

@ -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>eschwartz@gentoo.org</email>
<name>Eli Schwartz</name>
</maintainer>
<maintainer type="project">
<email>python@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>

View File

@ -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'
}