# -*- 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 117675 2014-03-07 22:56:55Z macsforever2000@macports.org $

PortSystem          1.0
PortGroup           python 1.0

set _name           apache-libcloud
set _n              [string index ${_name} 0]

name                py-libcloud
version             0.14.1
categories-append   net
platforms           darwin
supported_archs     noarch
license             Apache-2

maintainers         bo.ingv.it:Peter.Danecek openmaintainer

description         Apache libcloud a unified interface into the cloud

long_description    \
    Apache Libcloud is a Python library which hides differences between \
    different cloud provider APIs and allows you to manage different \
    cloud resources through a unified and easy to use API.

homepage            http://libcloud.apache.org/

distname            ${_name}-${version}
master_sites        http://www.apache.org/dist/libcloud/ \
                    https://pypi.python.org/packages/source/${_n}/${_name}/

checksums           md5     0a645fcf3d8615ff1065f4ff9f663af4 \
                    sha1    e587c9c3519e7d061f3c2fb232af8ace593c8156 \
                    rmd160  6921ef826426109e1e92dde60ea266a56bcb234a \
                    sha256  fafe7a0945aff31fe24bbb0e8598427725ae235ce8541c776159b88af8b17a28

python.versions     26 27 32 33 34

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

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

    # Testing
    test.run            yes

    if {${test.run}} {
        depends_build-append    port:py${python.version}-mock

        set test_dir ${worksrcpath}/libcloud/test
        pre-test  { copy ${test_dir}/secrets.py-dist ${test_dir}/secrets.py }
        post-test { delete ${test_dir}/secrets.py }
    }

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

        eval copy [glob ${worksrcpath}/example_*.py] ${dest_doc}/examples
    }

    livecheck.type  none
}
