# -*- 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
PortGroup           select 1.0

name                py-dns-lexicon
version             3.5.6
epoch               1
revision            0
categories-append   net
license             MIT
maintainers         {mps @Schamschula} openmaintainer
description         Manipulate DNS records on various DNS providers in a \
                    standardized/agnostic way.
long_description    ${description}
platforms           darwin
homepage            https://github.com/AnalogJ/lexicon

python.versions     27 36 37 38 39

checksums           rmd160  0d896354caca90fae0029d33a6dbf8ba985d1695 \
                    sha256  78e72b9c6fe293b329df31b30d92da23f1016f72ebefe3016b6deb7f0257c20b \
                    size    152076

if {${name} ne ${subport}} {
    depends_lib-append  \
                    port:py${python.version}-cryptography \
                    port:py${python.version}-dnspython \
                    port:py${python.version}-future \
                    port:py${python.version}-requests \
                    port:py${python.version}-tldextract \
                    port:py${python.version}-yaml

    if {${python.version} < 37} {
        python.rootname \
                    lexicon
        version     3.3.28
        epoch       1
        revision    1

        checksums   rmd160  350bc0315c4f176ab2774387f17110c1cc29cd37 \
                    sha256  0dc0c1a9a33ec53a6ac8eb78d1faf1d0062cce9338bbc80e6e45fb7e621599a7 \
                    size    6840070

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

    } else {
        PortGroup       active_variants 1.1

        python.pep517   yes

        require_active_variants \
                    poetry python${python.version}

        depends_build-append \
                    port:poetry \
                    port:py${python.version}-poetry-core \
                    port:py${python.version}-wheel

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

    post-destroot {
        # binary is not set to executable, see https://trac.macports.org/ticket/62297
        file attributes ${destroot}${frameworks_dir}/Python.framework/Versions/${python.branch}/bin/lexicon -permissions a+x
    }

    depends_run         port:lexicon_select
    select.group        lexicon
    select.file         ${filespath}/lexicon${python.version}

    notes "
    To make the Python ${python.branch} version of lexicon the one that is run\
    when you execute the commands without a version suffix, e.g. 'lexicon', run:
    port select --set ${select.group} [file tail ${select.file}]
    "

    livecheck.type  none
}
