# -*- 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-werkzeug
python.rootname     werkzeug
version             3.1.3
revision            0
categories-append   www
license             BSD
supported_archs     noarch
platforms           {darwin any}

python.versions     27 39 310 311 312 313
python.pep517_backend   flit

maintainers         {stromnov @stromnov} openmaintainer

description         The Swiss Army knife of Python web development

long_description    Werkzeug is a one of the most advanced WSGI utility \
                    modules. It includes a powerful debugger, full featured \
                    request and response objects, HTTP utilities to handle \
                    entity tags, cache control headers, HTTP dates, cookie \
                    handling, file uploads, a powerful URL routing system \
                    and a bunch of community contributed addon modules.

homepage            https://palletsprojects.com/p/werkzeug/

checksums           rmd160  d175dd734fcd9f1768c9932503b9e288d6432b84 \
                    sha256  60723ce945c19328679790e3282cc758aa4a6040e4bb330f53d30fa546d44746 \
                    size    806925

if {${name} ne ${subport}} {
    depends_lib-append  port:py${python.version}-markupsafe

    if {${python.version} == 27} {
        python.rootname     Werkzeug
        python.pep517       no

        version             1.0.1
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  9dc625e19c6cb90783972a8d467bd5270aafe30c \
                            sha256  6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c \
                            size    904455
        depends_lib-append  port:py${python.version}-setuptools
    }

    post-destroot {
        set docdir ${destroot}${prefix}/share/doc/${subport}
        xinstall -m 755 -d ${docdir}/examples
        foreach f [glob -directory ${worksrcpath}/docs *] {
            copy $f ${docdir}/[file tail $f]
        }
        foreach f [glob -directory ${worksrcpath}/examples *] {
            copy $f ${docdir}/examples/[file tail $f]
        }
        delete ${docdir}/Makefile
    }

    # test before 2.x requires missed py-pathlib
    if {${python.version} > 27} {
        depends_test-append \
                        port:py${python.version}-cryptography \
                        port:py${python.version}-ephemeral-port-reserve \
                        port:py${python.version}-pytest-timeout \
                        port:py${python.version}-pytest-xprocess \
                        port:py${python.version}-watchdog

        if {${python.version} < 311} {
            depends_test-append \
                        port:py${python.version}-greenlet
        }

        # Test is broken under MacPorts without installed version
        # See: https://github.com/pallets/werkzeug/issues/2516
        test.run        yes
        # dev_server test is also broken
        # See: https://github.com/pallets/werkzeug/issues/2515
        test.args       -o addopts="-m 'not dev_server'"
    }

    livecheck.type      none
}
