# -*- 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.7.4
revision            0

categories-append   devel
license             MIT

python.versions     38 39 310 311 312

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  d9447947fa61d3965d805276182060ca4461a1cb \
                    sha256  0c84efd9548d545f63ac0060c1e4d39bb9b14db8b3c0652338aecc07b5adec52 \
                    size    714127

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
    }

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