# -*- 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
python.rootname     pyzmq

version             25.1.2
checksums           rmd160  bbd0b94530ff5ca4d6cdb2434e3b3ab5cf8a4a9f \
                    sha256  93f1aa311e8bb912e34f004cf186407a4e90eec4f0ecc0efd26056bf7eda0226 \
                    size    1402339
revision            0

python.versions     27 39 310 311 312 313

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

categories-append   devel net
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

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",}
    } else {
        depends_build-append \
                            port:py${python.version}-setuptools_scm
        depends_lib-append \
                            port:py${python.version}-packaging \
                            port:py${python.version}-cffi

        livecheck.regex     {"filename":"pyzmq-([0-9.]+).tar.gz",}
    }

    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}

        if {${python.version} >= 36} {
            # remove cython, required only for zmq development
            # double check during the next portfile upgrade
            reinplace "s|\"cython.*,||g" ${worksrcpath}/pyproject.toml
        }
    }
}
