# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=py3-publicsuffix2
_pkgname=python-publicsuffix2
_pkgver=2.2019-12-21
pkgver=${_pkgver//-/}
pkgrel=6
pkgdesc="Python library to deal with publicsuffix data"
url="https://github.com/nexB/python-publicsuffix2"
license="MIT AND MPL-2.0"
arch="noarch"
depends="python3 py3-requests"
makedepends="py3-setuptools py3-gpep517"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$_pkgname-release-$_pkgver.tar.gz::https://github.com/nexB/python-publicsuffix2/archive/release-$_pkgver.tar.gz"
builddir="$srcdir/$_pkgname-release-$_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
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl

	# remove stray license file; SPDX identifier is sufficient in Alpine
	rm "$pkgdir"/usr/lib/python3.*/site-packages/publicsuffix2/mpl-2.0.LICENSE
}

sha512sums="
983bdb17b76d10eb73cf69f0ba7590806bf6786ae0c30526593ce1ab97f3b22c967f9acae83b880dd56be41a29eae9cca5726926667eb74013d0d1078433bf05  python-publicsuffix2-release-2.2019-12-21.tar.gz
"
