# -*- 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           github 1.0
PortGroup           python 1.0

github.setup        mitmproxy mitmproxy 9.0.1 v
revision            0

name                py-${github.project}

categories-append   net www
supported_archs     noarch
license             MIT
maintainers         {petr @petrrr} \
                    {@barracuda156 macos-powerpc.org:barracuda} \
                    openmaintainer

description         SSL/TLS-capable man-in-the-middle proxy for HTTP and Websockets
long_description    \
    mitmproxy is an SSL/TLS-capable man-in-the-middle proxy for HTTP/1, HTTP/2 \
    and Websockets. It provides a console interface that allows traffic flows \
    to be inspected and edited on the fly. mitmdump is the command-line version \
    of mitmproxy, with the same functionality but without the user interface. \
    Think tcpdump for HTTP.

homepage            https://mitmproxy.org

checksums           rmd160  cdcb915dfdca94cc58e3860409b6d0215c3251f1 \
                    sha256  2acd2c16e5bc02cd1dab8c58003254a71a2ee0ec0366001f624f85c980a2b43a \
                    size    29461514
github.tarball_from archive

patchfiles-append   0001-Revert-rusty-Wireguard-stuff.patch \
                    0002-tls.py-do-not-error-out-on-unsupported-dtls.patch

python.versions     39 310 311

if {${name} ne ${subport}} {
    depends_lib-append      port:py${python.version}-asgiref \
                            port:py${python.version}-blinker \
                            port:py${python.version}-brotli \
                            port:py${python.version}-certifi \
                            port:py${python.version}-cryptography \
                            port:py${python.version}-flask \
                            port:py${python.version}-h11 \
                            port:py${python.version}-h2 \
                            port:py${python.version}-hyperframe \
                            port:py${python.version}-kaitaistruct \
                            port:py${python.version}-ldap3 \
                            port:py${python.version}-msgpack \
                            port:py${python.version}-openssl \
                            port:py${python.version}-parsing \
                            port:py${python.version}-passlib \
                            port:py${python.version}-publicsuffix2 \
                            port:py${python.version}-protobuf3 \
                            port:py${python.version}-pyperclip \
                            port:py${python.version}-ruamel-yaml \
                            port:py${python.version}-ruamel-yaml-clib \
                            port:py${python.version}-sortedcontainers \
                            port:py${python.version}-tornado \
                            port:py${python.version}-urwid \
                            port:py${python.version}-wsproto \
                            port:py${python.version}-zstd

    # Testing dependencies
    depends_test-append     port:py${python.version}-pytest \
                            port:py${python.version}-asynctest \
                            port:py${python.version}-beautifulsoup4 \
                            port:py${python.version}-hypothesis \
                            port:py${python.version}-pytest-asyncio \
                            port:py${python.version}-tz \
                            port:py${python.version}-parver \
                            port:py${python.version}-requests

    post-patch {
        # Remove all upper bounds - potential breakings are detected by test
        reinplace "s/, *<\[0-9=.\]*//" ${worksrcpath}/setup.py
    }

    test.run yes
    # ignore pytest.PytestDeprecationWarning since pytest 6
    test.cmd py.test-${python.branch} -W ignore::pytest.PytestDeprecationWarning

    livecheck.type  none
} else {
    livecheck.type  pypi
}
