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

# keep version for Python < 3.4, these are (indirect) dependencies of py-virtualenv
# See <https://trac.macports.org/wiki/Python#VersionPolicy>
python.versions     27 35 36 37 38 39 310 311 312 313
python.pep517       yes

maintainers         {stromnov @stromnov} openmaintainer

description         Package to manage versions by scm tags.
long_description    {*}${description}

homepage            https://github.com/pypa/setuptools_scm/

checksums           rmd160  a46da9235cac52a38f56693de37da1272da006c4 \
                    sha256  6662c9b9497b6c9bf13bead9d7a9084756f68238302c5ed089fb4dbd29d102d7 \
                    size    201229

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

    if {${python.version} in "27 35"} {
        version             5.0.2
        revision            0
        checksums           rmd160  9a479a8c63f12ea4a07714e5a8f11a6b918f8d48 \
                            sha256  83a0cedd3449e3946307811a4c7b9d89c4b5fd464a2fb5eeccd0a5bb158ae5c8 \
                            size    52273
        python.pep517       no
    } elseif {${python.version} eq 36} {
        version             6.4.2
        revision            0
        checksums           rmd160  6876656de603d15079102abf2f9ed18f2937f7db \
                            sha256  6833ac65c6ed9711a4d5d2266f8024cfa07c533a0e55f4c12f6eff280a5a9e30 \
                            size    61305
        python.pep517       no
        depends_lib-append  port:py${python.version}-packaging \
                            port:py${python.version}-tomli
    } elseif {${python.version} eq 37} {
        version             7.1.0
        revision            0
        checksums           rmd160  b1eb6c49bb96267da40c145264609934da10df8a \
                            sha256  6c508345a771aad7d56ebff0e70628bf2b0ec7573762be9960214730de278f27 \
                            size    71904
        depends_lib-append  port:py${python.version}-importlib-metadata \
                            port:py${python.version}-tomli
    } else {
        patchfiles-append   patch-tomli-pyproject.toml.diff

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

        if {${python.version} < 310} {
            depends_lib-append  port:py${python.version}-typing_extensions \
                                port:py${python.version}-importlib-metadata
        }

        if {${python.version} < 311} {
            depends_lib-append  port:py${python.version}-tomli
        }
    }

    if {${python.version} < 37} {
        # https://trac.macports.org/ticket/57199
        use_configure       yes
        configure.cmd       ${python.bin}
        configure.pre_args
        configure.args      setup.py egg_info
    }

    livecheck.type      none
}
