# -*- 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           legacysupport 1.1

name                py-zmq

version             24.0.1
checksums           rmd160  0ac801641ec647e106f6d42f985bb14cdd780cd0 \
                    sha256  216f5d7dbb67166759e59b0479bca82b8acf9bed6015b526b8eb10143fb08e77 \
                    size    1219822
revision            0

python.versions     27 35 36 37 38 39 310 311

maintainers         {gmail.com:jrjsmrtn @jrjsmrtn} {michaelld @michaelld} openmaintainer

categories-append   devel net
platforms           darwin
license             LGPL

description         Python bindings for 0MQ

long_description    PyZMQ is a lightweight and super-fast messaging library \
                    built on top of the ZeroMQ library.

homepage            https://github.com/zeromq/pyzmq
master_sites        pypi:p/pyzmq

if {${name} ne ${subport}} {

    depends_lib-append path:lib/libzmq.dylib:zmq 

    if {${python.version} == 27} {

        # PyZMQ 20.0.0 dropped support for Python < 3.5 (all versions
        # of Python < 3.6 are EOL at time of release). Since this port
        # was already upgraded to 20.0.0, bump the epoch and cap the
        # Py27 version at 19.X. https://trac.macports.org/ticket/61708
        epoch               1
        version             19.0.2
        checksums           rmd160 008be479b08313768a8cba8b20a2d813101be4a0 \
                            sha256 296540a065c8c21b26d63e3cea2d1d57902373b16e4256afe46422691903a438 \
                            size   1156195
        revision            0
        livecheck.regex     {"filename":"pyzmq-(19.[0-9.]+).tar.gz",}

    } elseif {${python.version} == 35} {

        # PyZMQ 21.0.0 dropped support for Python 3.6
        version             20.0.0
        checksums           rmd160  c21dad4a3fe0e5e2a5fe34e6967b82300775f859 \
                            sha256  824ad5888331aadeac772bce27e1c2fbcab82fade92edbd234542c4e12f0dca9 \
                            size    1213019
        revision            0

        depends_lib-append  port:py${python.version}-setuptools
        livecheck.regex     {"filename":"pyzmq-(20.[0-9.]+).tar.gz",}

    } else {

        depends_lib-append  port:py${python.version}-setuptools \
                            port:py${python.version}-packaging
        livecheck.regex     {"filename":"pyzmq-([0-9.]+).tar.gz",}

    }

    distname                pyzmq-${version}

    post-patch {
        set setup_cfg ${worksrcpath}/setup.cfg
        file delete ${setup_cfg}
        file copy ${worksrcpath}/setup.cfg.template ${setup_cfg}
        reinplace "s|/usr/local|${prefix}|g" ${setup_cfg}
    }
}

livecheck.name pyzmq
