# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-warcio
pkgver=1.7.4
pkgrel=1
pkgdesc="Streaming WARC/ARC library for fast web archive IO"
url="https://github.com/webrecorder/warcio"
arch="noarch"
license="Apache-2.0"
# tests known to be broken due to missing file(s) in distribution tarball
# https://github.com/webrecorder/warcio/issues/132
options="!check"
depends="py3-six"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="
	py3-pytest
	py3-pytest-cov
	py3-pytest-httpbin
	py3-requests
	py3-wsgiprox
	"
subpackages="$pkgname-pyc"
source="py3-warcio-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/w/warcio/warcio-$pkgver.tar.gz"
builddir="$srcdir/warcio-$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 \
		--doctest-modules ./warcio --cov warcio -v test/
}

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

sha512sums="
7ae2a755fb4c9aba2ea8bf0f9c9b73d82d4e9a28ce6d66eb9597716f8a42fbe587cc333831267f94c9e1b9ef19ce90ea014bd4af2f1f7b63a82ff7a1591f9388  py3-warcio-1.7.4.tar.gz
"
