# Maintainer (Arch):
# Contributor (Arch): Angel 'angvp' Velasquez <angvp[at]archlinux.com.ve>
# Contributor (Arch): William Rea <sillywilly@gmail.com>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: fauno <fauno@kiwwwi.com.ar>
# Contributor: borgo <nomail>
# Contributor: André Silva <emulatorman@hyperbola.info>

_origname=reportlab
pkgname=python-reportlab
pkgver=3.5.34
pkgrel=1
pkgrel+=.parabola1
pkgdesc="A proven industry-strength PDF generating solution"
pkgdesc+=", without nonfree Adobe T1 fonts support"
arch=('x86_64')
arch+=('i686' 'armv7h')
url="https://bitbucket.org/rptlab/reportlab"
depends=('freetype2')
depends=('python' 'python-pip' 'python-pillow')
makedepends=('freetype2' 'python-pillow' 'mercurial')
license=('BSD')
source=(https://files.pythonhosted.org/packages/source/${_origname::1}/${_origname}/${_origname}-${pkgver}.tar.gz
        'free-fonts.patch')
sha256sums=('9675a26d01ec141cb717091bb139b6227bfb3794f521943101da50327bff4825'
            '7e31b2a2bde509d628cb7da9fec301d730d38ea8a8dc9956cdfc8da4ebeec370')

prepare() {
    cd ${_origname}-${pkgver}

    # remove nonfree Adobe T1 fonts support
    patch -p1 -i ../free-fonts.patch

    # Parabola contains those fonts from the ttf-bitstream-vera package
    rm -fv src/reportlab/fonts/{bitstream-vera-license.txt,Vera*}
}

package() {
    cd ${_origname}-${pkgver}
    python setup.py install --root="$pkgdir" --optimize=1
    install -D -m644 LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/license.txt
}

check() {
    cd ${_origname}-${pkgver}
    python setup.py tests
}
