# -*- 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 91976 2012-04-14 11:12:56Z jmr@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-polygon
version             2.0.4
revision            1
categories-append   devel math
license             LGPL
platforms           darwin

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://polygon.origo.ethz.ch/
master_sites        http://download.origo.ethz.ch/polygon/2890/
distname            Polygon-${version}
use_zip             yes

checksums           md5     9a036b22d1ee9568b8cbfa40b0bfa721 \
                    sha1    aa734572c911c0ddb4b39d1bf21f8ecbfa3685c8 \
                    rmd160  dfb26325998f3e8b44ac36f6ef2c0be30b8d9fd9

python.versions     25 26 27
python.default_version 27

variant numpy description {Build with NumPy support} {
    if {$subport != $name} {
        depends_lib-append  port:py${python.version}-numpy
        patchfiles-append   patch-setup.py.diff
    }
}

if {$subport != $name} {
    depends_lib-append  port:py${python.version}-distribute

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

livecheck.type      regex
livecheck.url       ${homepage}/download
livecheck.regex     "Polygon-(2+(?:\\.\\d+)*)${extract.suffix}"
