# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Johannes Löthberg <johannes@kyriasis.com>
# Contributor: Ivan Shapovalov <intelfx@intelfx.name>

pkgname=python-pynacl
pkgver=1.5.0
pkgrel=2.1

pkgdesc='Python binding to the Networking and Cryptography (NaCl) library'
url='https://pypi.python.org/pypi/PyNaCl'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=('Apache-2.0')

depends=('glibc' 'libsodium' 'python' 'python-cffi')
makedepends=('python-build' 'python-installer' 'python-pycparser' 'python-setuptools' 'python-wheel')
checkdepends=('python-pytest' 'python-hypothesis')

source=("https://pypi.org/packages/source/P/PyNaCl/PyNaCl-$pkgver.tar.gz")

sha512sums=('cea3e4556432588630382abae6debf9203c7f55da286509da547a7921e4dbad98c915743625c68e5f7187fcaf6d4cdaf7ed2ed3ba60bd4c10ae6e3f88608dc65')

build() {
	export SODIUM_INSTALL=system

	cd "$srcdir"/PyNaCl-$pkgver
	python -m build --wheel --no-isolation
}

check() {
	cd "$srcdir"/PyNaCl-$pkgver
	local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
	PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-$python_version" pytest
}

package() {
	export SODIUM_INSTALL=system

	cd PyNaCl-$pkgver
	python -m installer --destdir="$pkgdir" dist/*.whl
}

# vim: set ts=4 sw=4 tw=0 ft=PKGBUILD :
