# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-telegram-bot
_pkgname=python-telegram-bot
pkgver=21.10
pkgrel=0
pkgdesc="A Python wrapper around the Telegram Bot API"
url="https://github.com/python-telegram-bot/python-telegram-bot"
arch="noarch"
license="LGPL-3.0-or-later"
depends="py3-future py3-certifi py3-tornado py3-cryptography py3-decorator"
#checkdepends="pytest py-cffi py-cryptography py-future py-pathlib2"
options="!check" # few requirements-dev.txt packages missing in alpine
makedepends="py3-setuptools py3-gpep517 py3-hatchling"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/python-telegram-bot/python-telegram-bot/archive/v$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-telegram-bot" # Backwards compatibility
provides="py-telegram-bot=$pkgver-r$pkgrel" # Backwards compatibility

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

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m unittest discover
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
ecfeeeb848e0df591611e94f49d747790bf2db95a4ef6bcccf852469fbaf84535700cb0fe1483b06bae8cdcf6f1ef50851051dc6c793c3991fb75632acf3a7af  py3-telegram-bot-21.10.tar.gz
"
