# Contributor: prspkt <prspkt@protonmail.com>
# Maintainer: prspkt <prspkt@protonmail.com>
pkgname=py3-port-for
_pkgname=port-for
pkgver=0.7.2
pkgrel=1
pkgdesc="Utility and library that helps with local TCP ports management"
url="https://github.com/kmike/port-for"
arch="noarch"
license="MIT"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$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

	# Low ports are available on the CI
	.testenv/bin/python3 -m pytest \
		-k 'test_binding_high or not test_binding'
}

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

sha512sums="
093d35af3954f5d21753f1ecfcdb616829bfd6079e5f8b2208930881d12c93cbc9a065ca53289d9836ba1c266637661f518fb4cc61bc7a33aa5e469589b65e4c  port-for-0.7.2.tar.gz
"
