# -*- 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 98964 2012-10-22 16:38:26Z jmr@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-urlgrabber
version             3.9.1
python.versions     24 25 26 27
license             LGPL-2.1+
maintainers         afb stromnov openmaintainer

description         High-level cross-protocol url-grabber

long_description    Urlgrabber is a high-level cross-protocol url-grabber for python \
                    supporting HTTP, FTP and file locations. Features include keepalive, \
                    byte ranges, throttling, authentication, proxies and more.

platforms           darwin
supported_archs     noarch

homepage            http://urlgrabber.baseurl.org/
master_sites        http://urlgrabber.baseurl.org/download/
distname            urlgrabber-${version}

checksums           md5     00c8359bf71062d0946bacea521f80b4 \
                    sha1    937c7ad3177539c337d4010e0175b2c7bd874938 \
                    rmd160  377196ddb01f6cd4903e063e8e9cba40a0f80fff

if {$subport != $name} {

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

    post-patch {
        reinplace "s|/usr/bin/python|${python.bin}|g" \
            ${worksrcpath}/scripts/urlgrabber
    }

    livecheck.type      none

} else {

    livecheck.type      regex
    livecheck.url       ${master_sites}
    livecheck.regex     "urlgrabber-(\\d+(?:\\.\\d+)*)${extract.suffix}"

}
