# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-wordcloud
_pkgorig=wordcloud
pkgver=1.9.4
pkgrel=0
pkgdesc="A little word cloud generator in Python"
url="https://github.com/amueller/word_cloud"
arch="all"
license="MIT AND Apache-2.0"
depends="python3 py3-matplotlib py3-numpy py3-pillow"
makedepends="cython python3-dev py3-gpep517 py3-setuptools py3-wheel py3-setuptools_scm"
checkdepends="py3-coverage py3-mock py3-pytest-xdist py3-pytest-cov"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/amueller/word_cloud/archive/refs/tags/$pkgver.tar.gz
	include-assets.patch
	"
builddir="$srcdir/word_cloud-$pkgver"

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION="$pkgver"
	rm -fv wordcloud/query_integral_image.c
	cythonize wordcloud/query_integral_image.pyx
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	local _exclude='
		not test_unicode_with_stopwords
		and not test_wordcloud_cli
		and not test_recolor_too_small
		and not test_recolor_too_small_set_default
		and not test_coloring_black_work
	'

	mv wordcloud wordcloud.src
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -k "$(echo $_exclude)"
}

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

sha512sums="
159811c11a37fbd343e773802a57b89b06574fb8e9abbdd07ac579e908afaeab86c29562718f781b29c6ebfc66061046a28f481e734ca0d90d53bb0732123590  py3-wordcloud-1.9.4.tar.gz
568b754bb44b7c72afdcbedbca3682e9b2afea1481434e377ca763b654184ed75ecfa2ab749eb9f75674416bed2f8996d4b7e15b88bc6d17473810a0c5be3269  include-assets.patch
"
