# -*- 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             25.0

platforms           {darwin any}
supported_archs     noarch
maintainers         {jmr @jmroot} openmaintainer
license             {BSD Apache-2}

description         Core utilities for Python packaging

long_description    This library provides Python packaging utilities \
                    that implement the interoperability \
                    specifications which have clearly one correct \
                    behaviour (eg: PEP 440) or benefit greatly from \
                    having a single shared implementation (eg: PEP \
                    425). The packaging project includes the \
                    following: version handling, specifiers, markers, \
                    requirements, tags, utilities.

homepage            https://packaging.pypa.io/

checksums           md5 ab0ef21ddebe09d1803575120d3f99f8 \
                    rmd160 794848bb2cb4541e6004559ceccdfe37e1243807 \
                    sha256 d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f

python.versions     27 35 36 37 38 39 310 311 312 313 314

if {$subport ne $name} {
    set docfiles [list LICENSE LICENSE.APACHE LICENSE.BSD README.rst]

    if {${python.version} >= 37} {
        python.pep517_backend   flit
        # break circular dependency with py-build
        python.add_dependencies no
        depends_build-append    port:py-bootstrap-modules \
                                port:py${python.version}-installer
        depends_lib-append      port:python${python.version}
        build.env-append    PYTHONPATH=${prefix}/share/py-bootstrap-modules
        build.args      --skip-dependency-check
    } else {
        depends_build-append    port:py${python.version}-setuptools
        depends_lib-append      port:py${python.version}-parsing
    }
    if {${python.version} == 37} {
        version     24.0
        revision    0
        checksums   md5 8e3bc7b152efc9ffadabddc9f8465b02 \
                    rmd160 1b7def1a451aa6d6f1b5626a8c9c81b3904c0898 \
                    sha256 eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9
    } elseif {${python.version} == 36} {
        version     21.3
        revision    0
        checksums   md5 e713c1939f294fd729af4a7be40dd141 \
                    rmd160 45ed4b85bf4ef2069e07dd2922849f7edf98363a \
                    sha256 dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb
    } elseif {${python.version} < 36} {
        version     20.9
        revision    0
        checksums   md5 5377308b3ba89f2d78c05e7f485be65d \
                    rmd160 13af4881f42cfaa3b857096a93001501a5884371 \
                    sha256 5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5
        lappend docfiles CHANGELOG.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
}
