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


github.setup        mitmproxy mitmproxy 6.0.2 v
revision            0

name                py-${github.project}

categories-append   net www
platforms           darwin
supported_archs     noarch
license             {MIT}
maintainers         {petr @petrrr} 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           md5     9985f0dbd65ed41cf5f29aee387410b7 \
                    rmd160  8dc1ac47ccd9b4e110990ba44f2794b15f361678 \
                    sha256  06933510b72548df4affc17bb3d86f3a41c2cd5f919f4ad779e4911b72f7ede4 \
                    size    27274442

patchfiles          patch-test_version.py.diff

python.versions     37 38 39

if {${name} ne ${subport}} {
    depends_build-append    port:py${python.version}-setuptools

    depends_lib-append      port:py${python.version}-asn1 \
                            port:py${python.version}-blinker \
                            port:py${python.version}-brotli \
                            port:py${python.version}-click \
                            port:py${python.version}-certifi \
                            port:py${python.version}-cryptography \
                            port:py${python.version}-flask \
                            port:py${python.version}-h2 \
                            port:py${python.version}-hyperframe \
                            port:py${python.version}-kaitaistruct \
                            port:py${python.version}-ldap3 \
                            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
}

subport py36-${python.rootname} {
    replaced_by py37-${python.rootname}
    PortGroup obsolete 1.0

}
