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

version             1.0.3
revision            0
categories-append   devel
license             MIT
supported_archs     noarch
platforms           {darwin any}

python.versions     36 37 38 39 310 311 312

maintainers         {danchr @danchr} openmaintainer

description         A simple, correct PEP517 package builder

long_description    {*}${description} which will invoke the PEP 517 \
                    hooks to build a distribution package. It is a \
                    simple build tool and does not perform any \
                    dependency management.

homepage            https://pypa-build.readthedocs.io/

checksums           md5 45f216f02135c6acb486ba325e8f8da3 \
                    rmd160 057ba87fa7012e52bd7617fc15d8954b80b8b125 \
                    sha256 538aab1b64f9828977f84bc63ae570b060a8ed1be419e7870b8b4fc5e6ea553b \
                    size   40797

python.pep517       yes

if {${name} ne ${subport}} {
    # don't depend on ourself
    python.add_dependencies no
    depends_lib-append  port:py${python.version}-packaging \
                        port:python${python.version}

    if {${python.version} >= 37} {
        # Avoid circular dependency with flit
        depends_build-append \
                        port:py-bootstrap-modules \
                        port:py${python.version}-installer
        depends_lib-append \
                        port:py${python.version}-pyproject_hooks
        build.env-append    PYTHONPATH=${worksrcpath}/src:${prefix}/share/py-bootstrap-modules
        build.args      --skip-dependency-check
    } else {
        version     0.9.0
        revision    0
        checksums   md5 f2dc1823b0eff7037e19be18e354b2f1 \
                    rmd160 d431de8027e33f1c21dd35b8852defd590ac5198 \
                    sha256 1a07724e891cbd898923145eb7752ee7653674c511378eb9c7691aab1612bc3c \
                    size   17450
        depends_build-append \
                        port:py${python.version}-python-install \
                        port:py${python.version}-setuptools \
                        port:py${python.version}-wheel
        depends_lib-append \
                        port:py${python.version}-pep517
        build.env-append    PYTHONPATH=${worksrcpath}/src
    }
    if {${python.version} < 310} {
        depends_lib-append \
                        port:py${python.version}-importlib-metadata
    }
    if {${python.version} < 311} {
        depends_lib-append \
                        port:py${python.version}-tomli
    }

    # just verify dependencies
    test.run            yes
    test.env-append     PYTHONPATH=${worksrcpath}/src
    test.cmd            ${python.bin} -m build
    test.target         --help

    livecheck.type      none
}
