# -*- 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

PortSystem          1.0
PortGroup           python 1.0

name                py-libcloud
python.rootname     apache-libcloud
version             3.0.0
revision            0

categories-append   net
platforms           {darwin any}
supported_archs     noarch
license             Apache-2
maintainers         {petr @petrrr} 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            https://libcloud.apache.org/

checksums           rmd160  abddb1a23c662434ef7cdb7351b12583ae4a6eef \
                    sha256  b9eef1a61383fd401a537cf0796a1067a265288b7ab89be93f5571961a8a2902 \
                    size    2136758

python.versions     27

if {${name} ne ${subport}} {
    if {${python.version} == 27} {
        version     2.8.2
        revision    0
        checksums   rmd160  c4446b8be3783817d9b7d25c485fb8d7fa0e1977 \
                    sha256  cfd1f525c9646820cdcbcac596459f87188e1872aa9b59b69b5731d8e34675f3 \
                    size    2079694

        depends_lib-append \
                    port:py${python.version}-backports-ssl_match_hostname \
                    port:py${python.version}-typing \
                    port:py${python.version}-enum34
    }

    depends_build-append \
                    port:py${python.version}-setuptools

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

    depends_test-append \
                    port:py${python.version}-cryptography \
                    port:py${python.version}-mock \
                    port:py${python.version}-requests-mock \
                    port:py${python.version}-openssl

    test.run        yes

    set test_dir ${worksrcpath}/libcloud/test
    pre-test  { copy -force ${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 0755 -W ${worksrcpath} \
            LICENSE \
            NOTICE \
            CHANGES.rst \
            README.rst \
                ${dest_doc}

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

    livecheck.type  none
}
