# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-sphinx-autobuild
pkgver=2024.10.03
pkgrel=1
pkgdesc="Watch a Sphinx directory and rebuild the documentation when a change is detected"
url="https://github.com/executablebooks/sphinx-autobuild"
#arch="noarch"
arch="" # blocked by uvicorn
license="MIT"
replaces="py-sphinx-autobuild" #for backwards compatibility
provides="py-sphinx-autobuild=$pkgver-r$pkgrel" #for backwards compatibility
depends="
	py3-colorama
	py3-livereload
	py3-sphinx
	py3-starlette
	py3-tornado
	py3-watchfiles
	uvicorn
	"
makedepends="
	py3-gpep517
	py3-flit-core
	"
checkdepends="py3-pytest py3-starlette py3-pytest-httpx uvicorn py3-watchfiles"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/executablebooks/sphinx-autobuild/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir"/sphinx-autobuild-$pkgver

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

check() {
	python3 -m venv --clear --without-pip --system-site-packages test-env
	test-env/bin/python3 -m installer .dist/*.whl
	test-env/bin/python3 -m pytest
}

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

sha512sums="
5b919dd376cc0c2afc5d8623868e95fa7d0b9a693ea374c9ba7a6511d3bdfbfb5c0960e84d2cc64205588ad2651f80d1183260831f70144796abe17f4c2c87cc  py3-sphinx-autobuild-2024.10.03.tar.gz
"
