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

# keep version for Python 2.7, this is an (indirect) dependency of py-virtualenv
# See <https://trac.macports.org/wiki/Python#VersionPolicy>
python.versions     27 35 36 310 311 312 313 314
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  1a0c6266cd6c95ff9ac7e571d6e6b0171f210825 \
                    sha256  1c674ab4665686a0887d7e24c03ab25f24201c213e82ea689d2f3e169ef7ef57 \
                    size    203385

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
    } 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
}
