commit:     d801534ffd40f2e24033cb989333f9a0854629a5
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Mon May  5 19:37:14 2025 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Mon May  5 19:38:02 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d801534f

sci-ml/sentencepiece: include python bindings

Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 ....2.0-r2.ebuild => sentencepiece-0.2.0-r3.ebuild} | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/sci-ml/sentencepiece/sentencepiece-0.2.0-r2.ebuild 
b/sci-ml/sentencepiece/sentencepiece-0.2.0-r3.ebuild
similarity index 73%
rename from sci-ml/sentencepiece/sentencepiece-0.2.0-r2.ebuild
rename to sci-ml/sentencepiece/sentencepiece-0.2.0-r3.ebuild
index f35cc636641c..38348e58843f 100644
--- a/sci-ml/sentencepiece/sentencepiece-0.2.0-r2.ebuild
+++ b/sci-ml/sentencepiece/sentencepiece-0.2.0-r3.ebuild
@@ -3,7 +3,10 @@
 
 EAPI=8
 
-inherit cmake
+DISTUTILS_USE_PEP517=setuptools
+DISTUTILS_EXT=1
+PYTHON_COMPAT=( python3_{11..13} )
+inherit cmake distutils-r1
 
 DESCRIPTION="Text tokenizer for Neural Network-based text generation"
 HOMEPAGE="https://github.com/google/sentencepiece";
@@ -18,6 +21,7 @@ RDEPEND="
        dev-cpp/abseil-cpp:=
        dev-libs/protobuf:=
        dev-util/google-perftools
+       !sci-ml/pysentencepiece
 "
 DEPEND="${RDEPEND}
        dev-libs/darts
@@ -32,8 +36,6 @@ DOCS=(
        doc/special_symbols.md
 )
 
-PATCHES=( "${FILESDIR}"/${P}-gcc15.patch )
-
 src_prepare() {
        sed -i \
                -e "s:third_party/darts_clone/darts.h:darts.h:" \
@@ -43,7 +45,9 @@ src_prepare() {
                src/unigram_model.h \
                src/builder.cc \
                || die
+       eapply "${FILESDIR}"/${P}-gcc15.patch
        cmake_src_prepare
+       distutils-r1_src_prepare
 }
 
 src_configure() {
@@ -53,3 +57,14 @@ src_configure() {
        )
        cmake_src_configure
 }
+
+src_compile() {
+       cmake_src_compile
+       cd python
+       distutils-r1_src_compile
+}
+
+python_test() {
+       cd python
+       ${EPYTHON} test/sentencepiece_test.py || die
+}

Reply via email to