# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Lindsay Zhou <i@lin.moe>
maintainer="Lindsay Zhou <i@lin.moe>"
pkgname=py3-telethon
pkgver=1.40.0
pkgrel=0
pkgdesc="Full-featured Telegram client library"
url="https://docs.telethon.dev/"
arch="noarch"
license="MIT"
depends="
	py3-pyaes
	py3-rsa
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-pytest-asyncio
	"
subpackages="$pkgname-pyc"
source="https://github.com/LonamiWebs/Telethon/archive/v$pkgver/Telethon-v$pkgver.tar.gz
	0001-Add-send_as-and-message_effect_id-for-client-send_fi.patch
	"
builddir="$srcdir/Telethon-$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 -k 'not test_all_methods_present'
}

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

sha512sums="
b00bca0876187ff7bbf69c8996e19d20fc5c3d46d087f8406332740a75c4ae33e6fcd05efe8666ce58849b9249720887c071736a6d2afeb1382fe1d0e859a27c  Telethon-v1.40.0.tar.gz
df8b3cd02162f70a51e06c895dd7475a7cad1a8daa60176e4a532ff531a90d90ba1dc9443646cc3e78471aae5d773a3a29bf0c064671e8bed59a552a5ef3206f  0001-Add-send_as-and-message_effect_id-for-client-send_fi.patch
"
