# -*- 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-idna
version             3.18
revision            0
categories-append   devel
license             BSD
supported_archs     noarch
platforms           {darwin any}

python.versions     27 36 310 311 312 313 314
python.pep517_backend flit

maintainers         {stromnov @stromnov} openmaintainer

description         Internationalized Domain Names in Applications (IDNA).
long_description    {*}${description}

homepage            https://github.com/kjd/idna/

checksums           rmd160  f4942b3e5685f063af5ba4eb40c28ce9f149da04 \
                    sha256  ffb385a7e039654cef1ab9ef32c6fafe283c0c0467bba1d9029738ce4a14a848 \
                    size    196711

if {${name} ne ${subport}} {
    if {${python.version} < 310 && ${python.version} > 36} {
        version             3.11
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  eb73a6ffd25c9b30b8efdaf0e5ea43e5130d7098 \
                            sha256  795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902 \
                            size    194582
        depends_build-append \
                            port:py${python.version}-setuptools
    } elseif {${python.version} < 36} {
        version             2.10
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  57234789c6f95edce1725e7d3858a27da309e087 \
                            sha256  b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6 \
                            size    175616
        depends_build-append \
                            port:py${python.version}-setuptools
    } elseif {${python.version} eq 36} {
        version             3.3
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  39ab62813b06e88c80f13848c34c03a1c8600bb8 \
                            sha256  9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d \
                            size    286689
        depends_build-append \
                            port:py${python.version}-setuptools
    }

    post-extract {
        # Unreadable PKG-INFO breaks setuptools, and setuptools doesn't
        # ensure it is installed with read permissions.
        # https://github.com/pypa/setuptools/issues/1328
        # https://github.com/pypa/setuptools/issues/617
        fs-traverse item [list ${worksrcpath}] {
            if {[file isdirectory ${item}]} {
                file attributes ${item} -permissions a+rx
            } elseif {[file isfile ${item}]} {
                file attributes ${item} -permissions a+r
            }
        }
    }

    livecheck.type      none
}
