# Maintainer:
pkgname=py3-readability-lxml
pkgver=0.8.1
pkgrel=7
pkgdesc="fast python port of arc90's readability tool, updated to match latest readability.js!"
url="https://github.com/buriy/python-readability"
arch="noarch"
license="Apache-2.0"
depends="python3 py3-chardet py3-lxml py3-lxml-html-clean py3-cssselect"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-timeout-decorator"
# pypi version doesn't have tests
subpackages="$pkgname-pyc"
source="readability-lxml-$pkgver.tar.gz::https://github.com/buriy/python-readability/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/python-readability-$pkgver"

prepare() {
	default_prepare
	rm readability/compat/two.py
}

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 unittest
}

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

sha512sums="
c5b296a35606f65643f72e7d9ee07d6820a7a6a36ce97350673ea6076b704f7ed72f92ded47dac56690cdf3776eb8fadbb02ea234355a9982d4127976b2e6c6e  readability-lxml-0.8.1.tar.gz
"
