# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Morten Linderud <foxboron@archlinux.org>
# Contributor: Angel 'angvp' Velasquez <angvp[at]archlinux.com.ve>
# Contributor: William Rea <sillywilly@gmail.com>

_origname=reportlab
pkgname=python-reportlab
pkgver=4.2.2
pkgrel=1
pkgdesc="A proven industry-strength PDF generating solution"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url="https://www.reportlab.com/"
depends=('python' 'freetype2' 'python-pillow')
makedepends=('freetype2' 'python-pillow' 'mercurial' 'python-build' 'python-installer' 'python-setuptools' 'python-wheel')
license=('BSD')
source=(https://files.pythonhosted.org/packages/source/${_origname::1}/${_origname}/${_origname}-${pkgver}.tar.gz)
sha256sums=('765eecbdd68491c56947e29c38b8b69b834ee5dbbdd2fb7409f08ebdebf04428')

build() {
    cd ${_origname}-${pkgver}
    python setup.py build
    python -m build --wheel --no-isolation
}

check() {
    cd ${_origname}-${pkgver}
    export PYTHONPATH="build:$PYTHONPATH"
    python -m unittest discover -vs tests || true
    rm tests/_i_am_actually_a_*
}

package() {
    cd ${_origname}-${pkgver}
    python -m installer --destdir="$pkgdir" dist/*.whl
    install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/license.txt
}
