# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-wordcloud
_pkgorig=wordcloud
pkgver=1.9.3
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="
9863bec2d3cc8972e30a147cfd4ae2eadb79cbb0b472936e7ca789363cde549bb5b8bf6c5669462e9e96288cafc844510e4b33a5fb0f574c771222e85689ca87  py3-wordcloud-1.9.3.tar.gz
568b754bb44b7c72afdcbedbca3682e9b2afea1481434e377ca763b654184ed75ecfa2ab749eb9f75674416bed2f8996d4b7e15b88bc6d17473810a0c5be3269  include-assets.patch
"
