# Contributor: Anjandev Momi <anjan@momi.ca>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=stig
pkgver=0.12.11_alpha0
pkgrel=0
pkgdesc="TUI and CLI client for the BitTorrent client Transmission"
url="https://github.com/rndusr/stig"
arch="noarch"
license="GPL-3.0-or-later"
depends="python3 py3-urwid py3-urwidtrees py3-aiohttp py3-async-timeout py3-xdg py3-blinker py3-natsort py3-setproctitle"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-doc $pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/rndusr/stig/archive/refs/tags/v${pkgver//_alpha/a}.tar.gz"
options="!check" # py3-asynctest library is not compatible with Python 3.8 and above. See https://github.com/rndusr/stig/issues/206
builddir=$srcdir/stig-${pkgver//_alpha/a}

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

	install -Dm0644 -t "$pkgdir"/usr/share/doc/"$pkgname" \
		README.org CHANGELOG
}

sha512sums="
4b7fa6e0e0b834a4332343071f861b723f61887c635ed5c0c8b170fd91265283b0dddd40024c94a377d52917cfc0384ef1ad6d2065a53c8941d37a7c371eb555  stig-0.12.11_alpha0.tar.gz
"
