# -*- 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-packaging
version             21.3
revision            0

supported_archs     noarch
maintainers         nomaintainer
license             {BSD Apache-2}

description         Core utilities for Python packages

long_description    {*}$description

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

checksums           md5 e713c1939f294fd729af4a7be40dd141 \
                    rmd160 45ed4b85bf4ef2069e07dd2922849f7edf98363a \
                    sha256 dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \
                    size   84848

python.versions     27 35 36 37 38 39 310

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

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

    set docfiles {LICENSE LICENSE.APACHE LICENSE.BSD README.rst}

    if {${python.version} >= 36} {
        python.pep517   yes
        # break circular dependency with setuptools_scm and wheel
        python.add_dependencies no
        depends_build-append   port:py-bootstrap-modules
        depends_lib-append     port:python${python.version}
        build.env-append    PYTHONPATH=${prefix}/share/py-bootstrap-modules
        build.args      --skip-dependency-check
        destroot.env-append PYTHONPATH=${prefix}/share/py-bootstrap-modules
    } else {
        version     20.9
        revision    0
        checksums   md5 5377308b3ba89f2d78c05e7f485be65d \
                    rmd160 13af4881f42cfaa3b857096a93001501a5884371 \
                    sha256 5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5

        set docfiles {CHANGELOG.rst LICENSE LICENSE.APACHE LICENSE.BSD README.rst}
    }

    depends_test-append \
                    port:py${python.version}-pretend \
                    port:py${python.version}-pytest

    test.run        yes
    test.cmd        py.test-${python.branch}
    test.target
    test.env        PYTHONPATH=${worksrcpath}/build/lib

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        foreach docfile ${docfiles} {
            xinstall -m 0644 -W ${worksrcpath} ${docfile} ${destroot}${docdir}
        }
    }

    livecheck.type  none
}
