# -*- 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
PortGroup           github 1.0

github.setup        nucleic kiwi 1.3.2
github.tarball_from archive
name                py-kiwisolver
revision            0

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

description         Kiwi is an efficient C++ implementation of the Cassowary constraint solving algorithm.
long_description    Kiwi is an implementation of the algorithm based on the\
                    seminal Cassowary paper. It is not a refactoring of the\
                    original C++ solver. Kiwi has been designed from the ground\
                    up to be lightweight and fast. Kiwi ranges from 10x to 500x\
                    faster than the original Cassowary solver with typical use\
                    cases gaining a 40x improvement. Memory savings are\
                    consistently > 5x.

checksums           rmd160  de59d7d43168af463fc9e83ba8c73a5f12f194a3 \
                    sha256  36f3ceecd52aa16d5aebf5a6b6f3ba4e471de5bc95e634066393e4ef1f0d6ff1 \
                    size    89133

python.versions     27 35 36 37 38 39 310

if {${name} ne ${subport}} {
    if {${python.version} in "27 35"} {
        github.setup    nucleic kiwi 1.1.0
        revision        0
        checksums       rmd160  96f6c040491c7f4d279cf0b26b3704661a6621bb \
                        sha256  40c64d1d47ff5e3bdde95b41021f4d90f6e77fbe949c66daf390e1a0a71cc7cb \
                        size    55105
    } else {
        compiler.cxx_standard   2011

        depends_build-append \
                    port:py${python.version}-cppy

        # on 10.5 the build fails with the error (see ticket 61752):
        # gcc-mp-7: error: unrecognized command line option '-stdlib=libc++'
        if {![string match *clang* ${configure.cxx}]} {
            patchfiles-append   patch-setup.py.diff
        }
    }

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

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} LICENSE README.rst \
            ${destroot}${docdir}
    }

    pre-test {
        test.env    PYTHONPATH=[glob -nocomplain ${worksrcpath}/build/lib*]
    }

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

    test.run        yes
    test.cmd        py.test-${python.branch}
    test.target

    livecheck.type  none
} else {
    github.livecheck.regex  {([0-9.]+)}
}
