# -*- 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-logilab-common
version             2.1.0
revision            0
categories-append   devel
license             LGPL-2.1+
supported_archs     noarch
platforms           {darwin any}

python.versions     27 310 311 312 313

maintainers         {stromnov @stromnov} openmaintainer

description         A number of modules used by various projects from Logilab
long_description    {*}${description}

homepage            http://www.logilab.org/project/logilab-common

distname            logilab_common-${version}

checksums           rmd160  065d9850ab41839511c7baa4629620a19dd1cb8d \
                    sha256  d863c791dea08fce5d3e932bac2f03c322bfc0eb93d62d6bf974e7659e2bfb7e \
                    size    187464

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

    if {${python.version} eq 27} {
        version             1.4.4
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  7d8a73eda46a08132d83e41707fba15e945a4c4b \
                            sha256  8c1bf26431a3b487940cd4a7c0eefde328f5ff7098222ee695805752dae94aa6 \
                            size    177237
        depends_lib-append  port:py${python.version}-six
    } else {
        python.pep517       yes

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

    # Fix permissions
    post-extract {
        fs-traverse item ${worksrcpath} {
            if {[file isdirectory ${item}]} {
                file attributes ${item} -permissions a+rx
            } elseif {[file isfile ${item}]} {
                file attributes ${item} -permissions a+r
            }
        }
    }

    post-destroot {
        xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport}
        if {${python.version} ne 27} {
            xinstall -m 644 -W ${worksrcpath} ChangeLog README.rst \
                ${destroot}${prefix}/share/doc/${subport}
        } else {
            xinstall -m 644 -W ${worksrcpath} ChangeLog \
                ${destroot}${prefix}/share/doc/${subport}
        }
    }

    livecheck.type      none
}
