# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-webrtcvad
pkgver=2.0.10
pkgrel=1
pkgdesc="Python interface to the Google WebRTC Voice Activity Detector (VAD)"
url="https://github.com/wiseman/py-webrtcvad"
# 32-bit arches are not supported
# s390x, ppc64le and riscv64 are not supported
arch="all !x86 !armhf !armv7 !s390x !ppc64le !riscv64"
license="MIT AND BSD-3-Clause"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/wiseman/py-webrtcvad/archive/refs/tags/$pkgver.tar.gz
	0001-fix-build-error-on-py-webrtcvad.patch"
# No tests we can currently run
# Not a problem since in the next OVOS release (why we packaged this in the first place)
# this package won't be necessary any more anyway
options="!check"
builddir="$srcdir/py-webrtcvad-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest --ignore test_webrtcvad.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
ce414e39c3128e22495e8e21e46d09485952168ca763937cebb654dab87ffcfecea8198c74c009a47d8caed2a8ebc22572036fda4be36597d82e6e7057f80ae2  py3-webrtcvad-2.0.10.tar.gz
75bf61e983f98eec6d27c31fabd26e5859b84bbfc193dcf9efb20baaf6ecd7c27431057845a2b57b09b0796082781b0763b44948f308c3687c5f8f801ebffa1e  0001-fix-build-error-on-py-webrtcvad.patch
"
