# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-pynacl
pkgver=1.5.0
pkgrel=6
pkgdesc="Python3 binding to the Networking and Cryptography (NaCl) library"
url="https://github.com/pyca/pynacl"
arch="all"
license="Apache-2.0"
depends="py3-cffi"
makedepends="py3-gpep517 py3-setuptools python3-dev libffi-dev py3-wheel"
checkdepends="py3-pytest py3-hypothesis"
subpackages="$pkgname-pyc"
source="https://github.com/pyca/pynacl/archive/$pkgver/pynacl-$pkgver.tar.gz
	ppc64le-disable-configure-segfaultcheck.patch
	use-latest-pytest.patch
	"
builddir="$srcdir/pynacl-$pkgver"

replaces="py-pynacl" # Backwards compatibility
provides="py-pynacl=$pkgver-r$pkgrel" # Backwards compatibility

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="
905d3a7ce7f758b31a5d34471d5a0202fd2ba3d904a7ec59a158bcd1ea572fc87e29fc144c733d151cbaa48788c939808bc51d00acc973fe6d190eefdd3bfd59  pynacl-1.5.0.tar.gz
a96f649bb7d1552612f46668ce1c27dd4bb62e0e6459a02e9769a967c54ebe8467c3e8c515789a65838f5c55c96f381fabea4cc07fde8857a65f7dafa062c07c  ppc64le-disable-configure-segfaultcheck.patch
3966f72a4d46f1f15edef1b1abd67a823bbdf60419c20cd331271dd352e74c11bae45818f7bf367be892521a02852c31b768a527fc2c70133be6e24703dba663  use-latest-pytest.patch
"
