# -*- 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 119866 2014-05-08 17:27:33Z mf2k@macports.org $

PortSystem          1.0
PortGroup python    1.0

name                py-geoip
version             1.2.8
categories-append   net
license             LGPL-2.1+
platforms           darwin
maintainers         nomaintainer

description         Python module for accessing the GeoIP C library
long_description    ${description}

homepage            http://www.maxmind.com/app/python
master_sites        http://www.maxmind.com/download/geoip/api/python/
distname            GeoIP-Python-${version}

checksums           rmd160  5311cb3553943a71e7335732c06d070a4bf2768f \
                    sha256  8b946307355b60cb0f2b0be8ac90c1231286e0e79917509763267fce01a50e73

python.versions     24 25 26 27

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

    post-patch {
        reinplace "s|/usr/local|${prefix}|" ${worksrcpath}/setup.py
    }

    post-destroot   {
        xinstall -m 644 -W ${worksrcpath} ChangeLog LICENSE README \
            ${destroot}${prefix}/share/doc/${subport}
        xinstall -m 644 -W ${worksrcpath} test.py test_city.py test_org.py \
            ${destroot}${prefix}/share/doc/${subport}/examples
    }
    livecheck.type  none
} else {
    livecheck.type  regex
    livecheck.url   ${master_sites}
    livecheck.regex "GeoIP-Python-(\\d+(\\.\\d+)+)${extract.suffix}"
}
