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

python.versions     37 38 39 310 311 312 313 314

maintainers         {danchr @danchr} {jmr @jmroot} 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 34f31a0c3be1c827237b01696d3d0b89 \
                    rmd160 c38ddbfdc56bb2e90301b503ea5cd490ecce6c80 \
                    sha256 94e17f1db803ab22f46049376c44c8437c52090f0dfdf1adc43df56542d644fb

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

    # Avoid circular dependency with flit
    depends_build-append \
                    port:py-bootstrap-modules \
                    port:py${python.version}-installer
    build.env-append    PYTHONPATH=${worksrcpath}/src:${prefix}/share/py-bootstrap-modules
    build.args      --skip-dependency-check

    switch ${python.version} {
        39 {
            version     1.4.4
            revision    0
            checksums   md5 825cabb4439e5e7f55ee22a5c16e903c \
                        rmd160 8be04c250baef8c192084c485cf9c06b979f16c3 \
                        sha256 f832ae053061f3fb524af812dc94b8b84bac6880cd587630e3b5d91a6a9c1703
        }
        38 {
            version     1.2.2.post1
            revision    0
            checksums   md5 5492ba887b363f483d64a11bbec0c34a \
                        rmd160 42f52dafc1efeac7bf5696b2b901b72a3366fd6f \
                        sha256 b36993e92ca9375a219c99e606a122ff365a760a2d4bba0caa09bd5278b608b7 \
                        size   46701
        }
        37 {
            version     1.1.1
            revision    0
            checksums   md5 2bdd4d058ac29ab599d36ad09a28f0c1 \
                        rmd160 08f20b65fb7c229b9974a9dd176df8248d48c445 \
                        sha256 8eea65bb45b1aac2e734ba2cc8dad3a6d97d97901a395bd0ed3e7b46953d2a31 \
                        size   44711
        }
    }
    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
}
