# Contributor: Marian Buschsieweke <marian.buschsieweke@posteo.net>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=py3-cbor2
pkgver=5.6.5
pkgrel=0
pkgdesc="encoding and decoding for CBOR (RFC 8949)"
url="https://github.com/agronholm/cbor2"
arch="all"
license="MIT"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-setuptools_scm
	py3-wheel
	python3-dev
	"
checkdepends="
	py3-hypothesis
	py3-pytest
	py3-pytest-cov
	py3-tomli
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/c/cbor2/cbor2-$pkgver.tar.gz
	0001-fix-tests-on-32bit.patch
	"
builddir="$srcdir/cbor2-$pkgver"

build() {
	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="
9c3fc14b579e8c687b3e955452fcf9056fcfcce8ebe72b89c7d6e74e0ba5a29e0a61a225bbb6040f73285dfcc9f3bb37758badbbf45bd723ead8ecdf7e64b685  py3-cbor2-5.6.5.tar.gz
c550ac530d07d5e190bf7ddb23adafac85398e86429249f9cd0fceb33263de6ac12d5fb4149e7cd2d37d5c4d9178e07dd09a80e4c8609817e545eedb4e1d18d5  0001-fix-tests-on-32bit.patch
"
