# Contributor: Marten Ringwelski <git+alpine@maringuu.de>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=py3-ajsonrpc
pkgver=1.2.0
pkgrel=5
pkgdesc="Lightweight JSON-RPC 2.0 protocol implementation and asynchronous server powered by asyncio"
url="https://github.com/pavlov99/ajsonrpc"
arch="noarch"
license="MIT"
depends="python3"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/pavlov99/ajsonrpc/archive/refs/tags/$pkgver.tar.gz
	no-test-install.patch
	"
builddir="$srcdir/ajsonrpc-$pkgver"

build() {
	# See ajsonrpcs github actions
	echo "__version__ = \"$pkgver\"" >> ajsonrpc/__init__.py

	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
}

sha512sums="
af307f13c4e3a2b3004dc03629a3d0216c9c72014d290e66ad73b60925548fb3c1cf18d6b7ef6b270fca98b3b8efe9cc2741796f9b6f360267ab2df0a7eee9d3  py3-ajsonrpc-1.2.0.tar.gz
414a0b53b5c6eb1a5b0927d818c9223d76c75bc5f00f30a88b26166b50f47784c8e30e0605bf48a277ff25b914e25d4fa15bfe1083610778b2c2db39eb0be0eb  no-test-install.patch
"
