# -*- 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-configparser
epoch               1
version             5.0.2
revision            0

categories-append   devel
platforms           darwin
license             MIT
supported_archs     noarch

homepage            https://github.com/jaraco/configparser

description         Configparser from Python 3.8 to Python 2.6-3.7
long_description    ${description}

maintainers         {stromnov @stromnov} openmaintainer

python.versions     27 39

if {${name} ne ${subport}} {

    # 4.0.2 is the last py27-compatible version
    if {${python.version} == 27} {
        version             4.0.2

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

        distname            ${python.rootname}-${version}

        checksums           rmd160  9b6a5b12490e72c47ce2b1d190a35687c2d2c7eb \
                            sha256  c7d282687a5308319bf3d2e7706e575c635b0a470342641c93bea0ea3b5331df \
                            size    72498
    } else {
        depends_build-append \
                            port:py${python.version}-toml

        checksums           rmd160  4ff3a2f5f7313e1df0459a7a75b114acbd4caf58 \
                            sha256  85d5de102cfe6d14a5172676f09d19c465ce63d6019cf0a4ef13385fc535e828 \
                            size    71248
    }

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

    post-destroot {
        foreach f {__init__.py __init__.pyc __init__.pyo __pycache__} {
            set fp "${destroot}${python.pkgd}/backports/$f"
            if {[file exists ${fp}]} {
                file delete -force ${fp}
            }
        }
    }

    livecheck.type      none
}
