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

python.versions     27 310 311 312 313 314
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  7f37f79b70238da4f87097fc6e58927b79510111 \
                    sha256  210c6bede5a420a913956b4791a7f4d6843a43b6fcee4dfa08a65e93007d0d25 \
                    size    864736

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
}
