maintainer="Fabricio Silva <hi@fabricio.dev>"
pkgname=py3-qbittorrent-api
pkgver=2025.5.0
pkgrel=0
pkgdesc="Python client implementation for qBittorrent's Web API"
url="https://github.com/rmartin16/qbittorrent-api"
arch="noarch"
license="MIT"
depends="
	py3-requests
	py3-setuptools
	"
makedepends="
	py3-gpep517
	py3-wheel
	py3-setuptools_scm
	py3-sphinx-copybutton
	py3-sphinx-autodoc-typehints
	"
subpackages="$pkgname-doc $pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/rmartin16/qbittorrent-api/archive/v$pkgver.tar.gz"
builddir="$srcdir/qbittorrent-api-$pkgver"
# tests requires an instance of qbittorrent running
# net for sphinx
options="net !check"

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
	sphinx-build -b man docs/source docs/build
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	install -Dm644 docs/build/qbittorrent-api.1 \
		-t "$pkgdir"/usr/share/man/man1

	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/tests
}

sha512sums="
5eadf42bcf649ef8f39029131a8f8086c8cf38f7b987be471efd32d6e2395653561d44550e4487c359e2738153500506c4153f870957be40f84fa663591ed68b  py3-qbittorrent-api-2025.5.0.tar.gz
"
