# -*- 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 123641 2014-08-11 20:47:16Z petr@macports.org $

PortSystem          1.0
PortGroup           python 1.0

set _name           restkit
set _n              [string index ${_name} 0]

name                py-${_name}
version             4.2.2
categories          python www
license             MIT
platforms           darwin
supported_archs     noarch
maintainers         petr openmaintainer

description         HTTP resource kit for Python

long_description    Restkit is an HTTP resource kit for Python. It allows \
                    you to easily access to HTTP resource and build objects \
                    around it. It's the base of couchdbkit a Python CouchDB \
                    framework.

homepage            http://benoitc.github.io/restkit/

master_sites        https://pypi.python.org/packages/source/${_n}/${_name}/
distname            ${_name}-${version}

checksums           md5 99fb4e1af6e1b25c488dace620b4676f \
                    sha1 305b75024893f64a62b5a018518f659c16532e39 \
                    rmd160 1e4f9cdfcf2c345ad35c001cfa8e3c778c052942

# Python >= 2.6 required
# Python 3.x is not yet officially supported
python.versions     26 27

if {${name} ne ${subport}} {
    depends_build-append    port:py${python.version}-setuptools

    depends_lib-append      port:py${python.version}-http-parser \
                            port:py${python.version}-socketpool

    # Adding documentation and examples
    post-destroot {
        set dest_doc ${destroot}${prefix}/share/doc/${subport}
        xinstall -d  ${dest_doc}
        xinstall -m 755 -W ${worksrcpath} \
            README.rst \
            LICENSE \
            NOTICE \
            THANKS \
                ${dest_doc}

        delete ${dest_doc}/examples
        copy ${worksrcpath}/examples ${dest_doc}/examples
    }

    livecheck.type  none
} else {
    livecheck.type  regex
    livecheck.url   [lindex ${master_sites} 0]
    livecheck.regex ">${_name}-(\\d+(\\.\\d+)+)\\${extract.suffix}<"
}
