# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=py3-oscrypto
_pkgname=${pkgname##py3-}
pkgver=1.3.0
pkgrel=7
pkgdesc="Python crypto library backed by the OS"
url="https://github.com/wbond/oscrypto"
arch="noarch"
license="MIT"
options="net"
# Loads libssl.so/libcrypto.so via Python's FFI.
depends="python3 py3-asn1crypto>=1.5.1 libssl3 libcrypto3"
makedepends="py3-setuptools"
checkdepends="py3-pytest openssl-dev>3" # only for .so symlinks
subpackages="$pkgname-doc $pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/wbond/oscrypto/archive/$pkgver.tar.gz
	use-importlib-instead-of-deprecated-imp-module-on-Py.patch
	test-failures-with-openssl-3.0.patch
	disable-badtls-tests.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	python3 setup.py build
}

check() {
	OSCRYPTO_USE_OPENSSL=/usr/lib/libcrypto.so,/usr/lib/libssl.so \
		pytest -v
}

package() {
	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	install -m644 docs/* \
		"$pkgdir"/usr/share/doc/$pkgname

	python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="
b5baf72e1a09615b267be4d1c4baf2375bb939b5bd3d717ca9ca70776541f590a8608bef95991967e23f3794e6220709ed2fe5acdedfe9bfce1921c879a74bec  py3-oscrypto-1.3.0.tar.gz
3947d3e975d0fe17b3b25524a0b77de9b41b8e537283422b4074a33645ce36688270d89bf9eb728e967f1a217629a78e362949428ab95d78267d39a3709264a8  use-importlib-instead-of-deprecated-imp-module-on-Py.patch
8357502a71f2b0067d2e55e47fc2a87201132e7d79fdb8e405667e0583e2966d33278d20ed630850a8d5e4117cbfc31b5c755b487b5e5a289fe5db6a0dd035c0  test-failures-with-openssl-3.0.patch
8845b6e11713a30c3643ce96f6cec474bcc384f1a32a89ea04ac4ebe5ca0c28b6b338cc4b1a8e7eb31f65adfdf398c74e9465467bcdc5c2f3bd4d188b751fc47  disable-badtls-tests.patch
"
