# Contributor: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
pkgname=py3-rapidjson
pkgver=1.12
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="
15d021491c64db53352830d8f3f62c8b48476fcb001f97c174bcbb9053d973eb135ceb92f14290a58f6ad6c5dfb24d02f6385c8cad70f4a74f5a5726aa0728e7  py3-rapidjson-1.12.tar.gz
"
