From 4a16684bbdd2bff2d80f7142d80c871d707aa6e2 Mon Sep 17 00:00:00 2001 From: Guy Godfroy Date: Tue, 26 Mar 2024 13:07:21 +0000 Subject: [PATCH] community/re2: enable python wrapper --- community/re2/APKBUILD | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/community/re2/APKBUILD b/community/re2/APKBUILD index 1198f52f113..086b1bb1936 100644 --- a/community/re2/APKBUILD +++ b/community/re2/APKBUILD @@ -3,7 +3,7 @@ pkgname=re2 pkgver=2024.03.01 _pkgver=${pkgver//./-} -pkgrel=0 +pkgrel=1 pkgdesc="Efficient, principled regular expression library" url="https://github.com/google/re2" arch="all" @@ -13,12 +13,17 @@ makedepends=" cmake icu-dev samurai + py3-gpep517 + py3-setuptools + py3-wheel + py3-pybind11-dev + python3-dev " checkdepends=" benchmark-dev gtest-dev " -subpackages="$pkgname-dev" +subpackages="$pkgname-dev py3-$pkgname-pyc:pyc py3-$pkgname:py3" provides="libre2=$pkgver-r$pkgrel" source="$pkgname-$pkgver.tar.gz::https://github.com/google/re2/archive/$_pkgver.tar.gz" builddir="$srcdir"/$pkgname-$_pkgver @@ -32,6 +37,13 @@ build() { -DRE2_USE_ICU=ON \ -DRE2_BUILD_TESTING="$(want_check && echo ON || echo OFF)" cmake --build build + # python build + cd python + export CPATH=:$builddir + export LIBRARY_PATH=:$builddir/build + gpep517 build-wheel \ + --wheel-dir .dist \ + --output-fd 3 3>&1 >&2 } check() { @@ -40,6 +52,18 @@ check() { package() { DESTDIR="$pkgdir" cmake --install build + + cd "$builddir"/python + python3 -m installer -d "$pkgdir" \ + .dist/*.whl +} + +py3() { + pkgdesc="Python3 wrapper for Google re2" + depends="py3-pybind11" + install_if="$pkgname=$pkgver-r$pkgrel python3" + + amove usr/lib/python* } sha512sums="