From e5f9c3a25ff454fc47e2a92c6f59578267022d92 Mon Sep 17 00:00:00 2001 From: Suyun Date: Sun, 3 May 2026 16:24:59 +0800 Subject: [PATCH] SPECS: Add python-kenlm --- SPECS/python-kenlm/2000-drop-cmake-dep.patch | 6 +++ SPECS/python-kenlm/python-kenlm.spec | 52 ++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 SPECS/python-kenlm/2000-drop-cmake-dep.patch create mode 100644 SPECS/python-kenlm/python-kenlm.spec diff --git a/SPECS/python-kenlm/2000-drop-cmake-dep.patch b/SPECS/python-kenlm/2000-drop-cmake-dep.patch new file mode 100644 index 000000000..539e72b0f --- /dev/null +++ b/SPECS/python-kenlm/2000-drop-cmake-dep.patch @@ -0,0 +1,6 @@ +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -1,2 +1,2 @@ + [build-system] +-requires = ["setuptools", "wheel", "cmake>=3.10"] ++requires = ["setuptools", "wheel"] diff --git a/SPECS/python-kenlm/python-kenlm.spec b/SPECS/python-kenlm/python-kenlm.spec new file mode 100644 index 000000000..5949e2f9c --- /dev/null +++ b/SPECS/python-kenlm/python-kenlm.spec @@ -0,0 +1,52 @@ +# SPDX-FileCopyrightText: (C) 2026 Institute of Software, Chinese Academy of Sciences (ISCAS) +# SPDX-FileCopyrightText: (C) 2026 openRuyi Project Contributors +# SPDX-FileContributor: Suyun +# +# SPDX-License-Identifier: MulanPSL-2.0 + +%global srcname kenlm + +Name: python-%{srcname} +Version: 0.3.0 +Release: %autorelease +Summary: KenLM: Faster and Smaller Language Model Queries +License: LGPL-3.0-or-later AND LGPL-2.1-or-later +URL: https://github.com/kpu/kenlm +#!RemoteAsset: sha256:c4628bb9fb63c8a6f9240035b8b037385cfc404cb72e933cf48878291edac1e8 +Source0: https://files.pythonhosted.org/packages/source/k/%{srcname}/%{srcname}-%{version}.tar.gz +Patch0: 2000-drop-cmake-dep.patch +BuildSystem: pyproject + +BuildOption(install): -l %{srcname} -L + +BuildRequires: pyproject-rpm-macros +BuildRequires: pkgconfig(python3) +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: python3dist(cython) +BuildRequires: pkgconfig(zlib) +BuildRequires: pkgconfig(bzip2) +BuildRequires: pkgconfig(liblzma) + +Provides: python3-%{srcname} +%python_provide python3-%{srcname} + +%description +KenLM is a library for estimating, filtering, and querying +language models with significantly lower memory usage. + +%prep +%autosetup -n %{srcname}-%{version} + +%generate_buildrequires +%pyproject_buildrequires + +%build -p +cython -3 --cplus python/kenlm.pyx -o python/kenlm.cpp + +%files -f %{pyproject_files} +%{python3_sitearch}/libkenlm.so +%license LICENSE COPYING COPYING.3 COPYING.LESSER.3 + +%changelog +%autochangelog