# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer:
pkgname=py3-gtts
pkgver=2.5.4
pkgrel=0
pkgdesc="A Python library and CLI tool to interface with Google Translate text-to-speech API"
url="https://github.com/pndurette/gTTS"
arch="noarch"
license="MIT"
depends="
	py3-click
	py3-requests
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-testfixtures
	"
subpackages="$pkgname-pyc"
source="https://github.com/pndurette/gTTS/archive/v$pkgver/gTTS-$pkgver.tar.gz"
# Net required for tests
options="net"
builddir="$srcdir/gTTS-$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
}

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

	rm -r "$pkgdir"/usr/lib/python3*/site-packages/gtts/tests/
	rm -r "$pkgdir"/usr/lib/python3*/site-packages/gtts/tokenizer/tests/
}

sha512sums="
9182aa809c2a889e399fe5e1cca00ad2bade99513b2a821d3f077e2d0560a0f8e10dd921bd7b66cfde87b972642213dfbc5a4dd4aea68f2e2cf04694611c7655  gTTS-2.5.4.tar.gz
"
