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

python.versions     39 310 311 312 313
python.pep517_backend hatch

maintainers         {stromnov @stromnov} openmaintainer

description         An implementation of JSON Schema validation for Python.
long_description    {*}${description}

homepage            https://github.com/python-jsonschema/jsonschema

checksums           rmd160  7d512e8bb4ac808fcf958129ca14d3b0faf678e9 \
                    sha256  e4a9655ce0da0c0b67a085847e00a3a51449e1157f4f75e9fb5aa545e122eb85 \
                    size    357342

if {${name} ne ${subport}} {
    depends_build-append \
                        port:py${python.version}-hatch-vcs \
                        port:py${python.version}-hatch-fancy-pypi-readme
    depends_lib-append  port:py${python.version}-attrs \
                        port:py${python.version}-jsonschema-specifications \
                        port:py${python.version}-referencing \
                        port:py${python.version}-rpds-py

    # On Yosemite and older OS-s rpds-py fails (requires rust)
    if {${os.platform} eq "darwin" && ${os.major} < 15} {
        version             4.17.3
        checksums           rmd160  86637e335ef60176700311eb93e0d5dbbcb8d457 \
                            sha256  0f864437ab8b6076ba6707453ef8f98a6a0d512a80e93f8abdb676f737ecb60d \
                            size    297785
        depends_lib-append  port:py${python.version}-pyrsistent
        depends_lib-delete  port:py${python.version}-jsonschema-specifications \
                            port:py${python.version}-referencing \
                            port:py${python.version}-rpds-py
    }

    livecheck.type      none
}

# py-jsonschema-format-nongpl metaport (jsonschema[format-nongpl])
foreach python_version ${python.versions} {
    subport py${python_version}-jsonschema-format-nongpl {
        supported_archs     noarch
        distfiles
        build {}
        destroot {
            xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${subport}
            system "echo ${subport} > ${destroot}${prefix}/share/doc/${subport}/stub"
        }
        depends_lib-append  port:py${python.version}-jsonschema \
                            port:py${python.version}-fqdn \
                            port:py${python.version}-idna \
                            port:py${python.version}-isoduration \
                            port:py${python.version}-jsonpointer \
                            port:py${python.version}-rfc3339-validator \
                            port:py${python.version}-rfc3986-validator \
                            port:py${python.version}-uri-template \
                            port:py${python.version}-webcolors
        livecheck.type      none
    }
}

