# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-openssl
# version needs to be compatible with py3-cryptography
pkgver=25.0.0
pkgrel=0
pkgdesc="Python3 wrapper module around the OpenSSL library"
url="https://github.com/pyca/pyopenssl"
arch="noarch"
license="Apache-2.0"
depends="python3 py3-cryptography py3-typing-extensions"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pretend
	py3-pytest-rerunfailures
	py3-pytest-xdist
	"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/p/pyOpenSSL/pyopenssl-$pkgver.tar.gz"
builddir="$srcdir/pyopenssl-$pkgver"

replaces="py-openssl" # Backwards compatibility
provides="py-openssl=$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 -n auto \
		--deselect tests/test_ssl.py::TestContext::test_set_tmp_ecdh
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
77f9f03610a4ddaf115d581b873e728a79ba0e8d762ddeffacb600b6bc4a50bde2edfc114aebe12b9e177f3d53c19fe0c2bf0a5821e609489b8640e23c324376  pyopenssl-25.0.0.tar.gz
"
