# -*- 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-dnspython
version             2.8.0
revision            0

categories-append   net
license             ISC
maintainers         {mps @Schamschula} openmaintainer

description         DNS toolkit for Python
long_description    dnspython is a DNS toolkit for Python. It supports almost all \
                    record types. It can be used for queries, zone transfers, and \
                    dynamic updates. It supports TSIG authenticated messages and EDNS0.
homepage            https://www.dnspython.org/

supported_archs     noarch
platforms           {darwin any}

checksums           rmd160  50989580345d7e83d7f2d0a507bea62982b83ae8 \
                    sha256  181d3c6996452cb1189c4046c61599b84a5a86e099562ffde77d26984ff26d0f \
                    size    368251

python.versions     27 310 311 312 313 314

if {${name} ne ${subport}} {
    depends_lib-append \
                    port:py${python.version}-cryptography \
                    port:py${python.version}-idna \
                    port:py${python.version}-requests \
                    port:py${python.version}-requests-toolbelt \
                    port:py${python.version}-sniffio \
                    port:py${python.version}-trio

    if {${python.version} eq 27} {
        version         1.16.0
        revision        0
        master_sites    ${homepage}kits/${version}

        checksums       rmd160  c3662f85998d51b437a3eaa0f5a04c3b0d61fd69 \
                        sha256  4bf5c5c12a4478ee7860ab176659cf64c4899ee76752d826b082f8af723c5cf9 \
                        size    150524

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

        depends_lib-delete \
                        port:py${python.version}-sniffio \
                        port:py${python.version}-trio
    } else {
        depends_lib-append \
                        port:py${python.version}-aioquic

        python.pep517_backend \
                        hatch

        test.run        yes
        # there currently 3 test failures in test_resolver.py
        # and 1 in test_resolver_override.py
    }

    post-destroot {
        if {${name} ne ${subport}} {
            xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${subport}/examples
            xinstall -m 0644 -W ${worksrcpath} LICENSE README.md \
                ${destroot}${prefix}/share/doc/${subport}
            xinstall -m 0644 -W ${worksrcpath}/examples ddns.py e164.py \
                mx.py name.py query_specific.py receive_notify.py reverse.py \
                reverse_name.py xfr.py zonediff.py \
                ${destroot}${prefix}/share/doc/${subport}/examples
        }
    }
}
