# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 119351 2014-04-23 12:01:06Z stromnov@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-reportlab
version             3.1.8
revision            0
categories-append   textproc
platforms           darwin
license             BSD

python.versions     24 25 26 27 33 34

maintainers         stromnov openmaintainer

description         Engine for creating PDF documents

long_description    The ReportLab Toolkit is a library for programatically \
                    creating documents in PDF format.

homepage            http://www.reportlab.com/software/opensource/rl-toolkit/
master_sites        https://pypi.python.org/packages/source/r/reportlab/ \
                    http://www.reportlab.com/ftp/

distname            reportlab-${version}

checksums           rmd160  ab188ba13941234122900efa55d678c4d0794033 \
                    sha256  35177c86ad52a3a3a15678f2f442694f1ff909cc303364899e8ca241934a262b

if {${name} ne ${subport}} {
    depends_lib-append  port:freetype

    # ReportLab 3.x requires Python 2.7+
    if {[lsearch {24 25 26} ${python.version}] != -1} {
        version             2.7
        revision            0
        checksums           rmd160  0ff90be737e925bc156c36dabb25b183834cf537 \
                            sha256  82b56935e4a75641b40eb22050f0b6e46a0f0a9ebfacdf3b24a1e9c0eef2af6d
        distname            reportlab-${version}

        patchfiles-append   patch-src_reportlab_lib_testutils.py.diff
    } elseif {${subport} eq "py27-reportlab"} {
        depends_lib-append  port:py${python.version}-pil
    } else {
        depends_lib-append  port:py${python.version}-Pillow
    }

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -m 644 -W ${worksrcpath} README.txt CHANGES.txt LICENSE.txt \
            ${destroot}${docdir}
    }

    livecheck.type      none
} else {
    livecheck.type      regex
    livecheck.url       [lindex ${master_sites} 0]
    livecheck.regex     {reportlab-(\d+(?:\.\d+)*)\.[tz]}
}
