# Contributor: Marian Buschsieweke <marian.buschsieweke@posteo.net>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=py3-rapidjson
pkgver=1.20
pkgrel=0
pkgdesc="Python3 wrapper around RapidJSON"
url="https://github.com/python-rapidjson/python-rapidjson"
arch="all"
license="MIT"
depends="
	python3
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	rapidjson-dev
	"
checkdepends="
	py3-pytest
	py3-tz
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/python-rapidjson/python-rapidjson/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/"python-rapidjson-$pkgver

prepare() {
	default_prepare

	# workaround setup.py complaining about "sources not found"
	mkdir -v rapidjson/include
}

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

check() {
	PYTHONPATH="$(echo "$PWD"/build/lib.linux*)" pytest \
		--ignore benchmarks \
		--deselect tests/test_base_types.py::test_base_values \
		--deselect tests/test_unicode.py::test_unicode_decode_error \
		--deselect tests/test_validator.py::test_additional_and_pattern_properties_valid \
		#
}

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

sha512sums="
35cad81463864c4ad34bb0fa9d21cf13968a2b8c700c0698c9d9cd4201dc6762b3c79f21f745a534ab665679780ad121a073c6af9d527a3c7e8c604c4ef32801  py3-rapidjson-1.20.tar.gz
"
