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

python.versions     38 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  09d7c7f8504b54fbf4aac3a7c48726df90f377d3 \
                    sha256  85727c00279f5fa6bedbe6238d2aa6403bedd8b4864ab11207d07df3cc1b2ee5 \
                    size    321491

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

    if {${python.version} < 39} {
        depends_lib-append  port:py${python.version}-importlib-resources \
                            port:py${python.version}-pkgutil_resolve_name
    }

    # 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
    }
}
