# -*- 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

PortSystem          1.0
PortGroup           python 1.0

name                py-cairocffi
version             1.2.0
revision            0

categories-append   graphics
platforms           darwin
license             BSD
maintainers         {reneeotten @reneeotten} openmaintainer

description         cairocffi is a CFFI-based drop-in replacement for Pycairo
long_description    ${description}

homepage            https://github.com/Kozea/cairocffi

checksums           rmd160  edbfcfc08658abe6106fdd4290980ce5eac6610f \
                    sha256  9a979b500c64c8179fec286f337e8fe644eca2f2cd05860ce0b62d25f22ea140 \
                    size    70393

python.versions     27 35 36 37 38 39

if {${name} ne ${subport}} {
    depends_lib-append  path:lib/pkgconfig/cairo.pc:cairo \
                        port:gdk-pixbuf2 \
                        port:libffi \
                        port:py${python.version}-cffi

    # version 1.1.0 supports python36+
    if {${python.version} < 36} {
        version             0.9.0
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  111d84931f3315f5da65ac66d632071c3757f0d0 \
                            sha256  15386c3a9e08823d6826c4491eaccc7b7254b1dc587a3b9ce60c350c3f990337 \
                            size    84652

        depends_build-append \
                            port:py${python.version}-setuptools
    } else {
        depends_build-append \
                            port:py${python.version}-pytest-runner

        depends_lib-append \
                            port:py${python.version}-setuptools
    }

    depends_test-append \
                    port:py${python.version}-pytest \
                    port:py${python.version}-numpy

    test.run        yes
    test.dir        ${worksrcpath}/build/lib/cairocffi
    test.cmd        py.test-${python.branch}
    test.args       -o addopts=''
    test.target
    test.env        PYTHONPATH=${worksrcpath}/build/lib

    livecheck.type      none
}
