# Contributor: Jonas <spameier+alpine@proton.me>
# Maintainer: Jonas <spameier+alpine@proton.me>
pkgname=py3-mbedtls
_pyname=python-mbedtls
pkgver=2.10.1
pkgrel=3
pkgdesc="hash, hmac, RSA, ECC, X.509, TLS, DTLS, handshakes, and secrets with an mbed TLS back end"
url="https://github.com/Synss/python-mbedtls"
arch="all"
license="MIT"
depends="
	mbedtls2
	py3-certifi
	py3-typing-extensions
	"
makedepends="
	cython
	mbedtls2-dev
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="
	py3-pytest-repeat
	py3-pytest-timeout
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Synss/python-mbedtls/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$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
	rm -rf "$pkgdir"/usr/lib/python3.*/site-packages/tests/ # remove tests
}

sha512sums="
c0100c621bc0a0e9d16557902c5f059229ce30143bb8b93f2d916c90a78c4b4911b548d9829b2b1ebbc34f379129c8ab9b6ae471f1e8556785321c5978bc6a3d  py3-mbedtls-2.10.1.tar.gz
"
