# Maintainer: Butui Hu <hot123tea123@gmail.com>

_pkgname=word_cloud
pkgname=python-wordcloud
pkgver=1.9.6
pkgrel=1
pkgdesc='A little word cloud generator in Python'
arch=('x86_64')
url='https://github.com/amueller/word_cloud'
license=('MIT')
depends=(
  python-matplotlib
  python-numpy
  python-pillow
)
makedepends=(
  cython
  python-build
  python-installer
  python-setuptools
  python-setuptools-scm
  python-wheel
)
source=("${_pkgname}-${pkgver}.tar.gz::https://github.com/amueller/word_cloud/archive/refs/tags/${pkgver}.tar.gz")
sha512sums=('b8dd58064e1bec8fc028913c94410f8984b2eb7b0dc0b5c4cb2eadb18cb3851fddfff445405e99b0094ca90e17cb9e73a0e7aeb9fbf1132f0eb48cc3ca6e0729')

prepare() {
  # quick fix for missing files
  echo "include wordcloud/DroidSansMono.ttf" >> ${srcdir}/${_pkgname}-${pkgver}/MANIFEST.in
  echo "include wordcloud/stopwords" >> ${srcdir}/${_pkgname}-${pkgver}/MANIFEST.in
}

build() {
  cd "${_pkgname}-${pkgver}"
  SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver} \
  python -m build --wheel --no-isolation
}

package() {
  cd "${_pkgname}-${pkgver}"
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
# vim:set ts=2 sw=2 et:
