# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=py3-requests-unixsocket
pkgver=0.4.1
pkgrel=0
pkgdesc="Use requests to talk HTTP via a UNIX domain socket"
url="https://gitlab.com/thelabnyc/requests-unixsocket2"
arch="noarch"
license="ISC"
depends="py3-requests"
makedepends="py3-gpep517 py3-pbr py3-poetry-core"
checkdepends="py3-pytest py3-waitress"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/r/requests-unixsocket2/requests_unixsocket2-$pkgver.tar.gz"
builddir="$srcdir/requests_unixsocket2-$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

	# remove tests
	#
	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/requests_unixsocket/test*
	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/requests_unixsocket/__pycache__/test*
}

sha512sums="
ac1e78af4975a6c54af8d4af9eb3791c27f13c61b8b65046f03b82842254c8fb983fa0462368dd67abc0a9ce18caa7c3134d9bbada9ba8549ca0b45388ac80f2  requests_unixsocket2-0.4.1.tar.gz
"
