# -*- 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 114324 2013-12-05 08:44:51Z ryandesign@macports.org $

PortSystem          1.0
PortGroup           python 1.0

set realname        polygon

name                py-${realname}
version             3.0.6
revision            0
categories-append   devel math
platforms           darwin
license             LGPL Noncommercial

python.versions     25 26 27 32 33

maintainers         stromnov openmaintainer

description         Python bindings for General Polygon Clipping Library

long_description    \
    Polygon is a python package that simplifies the handling of polygons \
    in 2D. It contains Python bindings for gpc, the excellent General \
    Polygon Clipping Library by Alan Murta and some extensions written \
    in C and pure Python.

homepage            http://www.j-raedler.de/projects/polygon
master_sites        http://bitbucket.org/jraedler/polygon3/downloads

distname            Polygon3-${version}

checksums           rmd160  2bfe1173445e1b41f97a945b9a7df2282879e86f \
                    sha256  dea5b66870a9fd3031290f54f72d823c33bb8b8c21bec97c510d04df2608c637

if {${name} ne ${subport}} {
    if {${python.version} < 30} {
        version             2.0.6
        revision            0
        master_sites        http://bitbucket.org/jraedler/polygon2/downloads
        distname            Polygon2-${version}
        checksums           rmd160  ee32123e4856bccc4137a06c21ea2e3135ef053b \
                            sha256  3e0e1a5125e892faa5964523de28c0349b573ed102547e12a1affc3fed2cac3b
    }

    use_zip             yes

    patchfiles-append   patch-setup.py.diff

    variant numpy description {Build with NumPy support} {
        depends_lib-append  port:py${python.version}-numpy
        patchfiles-delete   patch-setup.py.diff
    }

    post-destroot {
        xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport}
        xinstall -m 644 -W ${worksrcpath}/doc \
            Examples.py Polygon.txt Polygon.pdf testpoly.gpf \
            ${destroot}${prefix}/share/doc/${subport}
    }

    livecheck.type      none
} else {
    livecheck.type      regex
    livecheck.url       ${master_sites}
    livecheck.regex     "Polygon\[23\]?-(\[23\]+(?:\\.\\d+)*)\.\[tz\]"
}
