# -*- 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-pydantic
version             2.11.4
revision            0

categories-append   devel
license             MIT

python.versions     39 310 311 312 313

maintainers         {@jandemter demter.de:jan} openmaintainer

description         Data validation and settings management using Python type hinting
long_description    Fast and extensible, pydantic plays nicely \
                    with your linters/IDE/brain. Define how data \
                    should be in pure, canonical Python 3.6+\; \
                    validate it with pydantic.

homepage            https://github.com/samuelcolvin/pydantic

checksums           rmd160  36459a8efd71506c42e4d500dc3049c22bd44cb4 \
                    sha256  32738d19d63a226a52eed76645a98ee07c1f410ee41d93b4afbfa85ed8111c2d \
                    size    786540

set pydantic_darwin_min_ver 13

if {${name} ne ${subport}} {
    if {${os.platform} eq "darwin" && ${os.major} < ${pydantic_darwin_min_ver}} {
        # Notice, this is not a version peg, as of now;
        # branch 1.x is still being updated.
        version     1.10.19
        revision    0
        checksums   rmd160  1c8d836cd6a55e6fe4f2262fe483cc7b47af4901 \
                    sha256  fea36c2065b7a1d28c6819cc2e93387b43dd5d3cf5a1e82d8132ee23f36d1f10 \
                    size    355208

        depends_build-append \
                    port:py${python.version}-cython-compat \
                    port:py${python.version}-pythran

        set compat_path     [string replace ${python.pkgd} 0 [string length ${python.prefix}]-1 ${prefix}/lib/py${python.version}-cython-compat]
        build.env-append    PYTHONPATH=${compat_path}

        livecheck.type      none

    } else {
        supported_archs     noarch
        platforms           {darwin any}

        python.pep517_backend \
                    hatch

        depends_build-append \
                    port:py${python.version}-hatch-fancy-pypi-readme

        depends_run-append \
                    port:py${python.version}-annotated_types \
                    port:py${python.version}-pydantic_core \
                    port:py${python.version}-typing-inspection
    }

    depends_run-append \
                    port:py${python.version}-typing_extensions
}
