# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-netaddr
_pyname=netaddr
pkgver=0.10.1
pkgrel=1
pkgdesc="A network address manipulation library for Python"
url="https://github.com/netaddr/netaddr"
arch="noarch"
license="BSD-3-Clause"
depends="python3"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/n/$_pyname/$_pyname-$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$pkgver"

replaces="py-netaddr" # Backwards compatibility
provides="py-netaddr=$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 -k 'not test_strategy_ipv6'
}

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

sha512sums="
ca04171d5cbfd569d4f262f4870610edfd98be35899cb70983dbff5f37add963e05987ddbe1ab22d9b615580ac1abe96a8c2903681b18af8c9f2f96899b618ff  netaddr-0.10.1.tar.gz
"
