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

name                py-event
github.setup        jaraco pyevent 842e0ac2609da70283309d156ce290bee9837fb3
version             0.4.3
maintainers         nomaintainer
license             BSD

description         Python extension module for libevent

long_description    This module provides a mechanism to execute a \
                    function when a specific event on a file handle, \
                    file descriptor, or signal occurs, or after a \
                    given time has passed.

homepage            https://pypi.python.org/pypi/event/
github.tarball_from archive
checksums           rmd160 8221100d17a22af4ea244e462321c599cb6675e9 \
                    sha256 5e4727fd7461aee9d7f3fe5dfc6f54b49301f582e7020224c8827c9e7c361426

python.versions     310 311
python.pep517       yes

if {$subport ne $name} {
    depends_build-append    port:py${python.version}-cython-compat
    depends_lib-append  port:libevent1

    patchfiles      setup.py.patch \
                    py3.patch
    post-patch {
        reinplace "s|__PREFIX__|${prefix}|" ${worksrcpath}/setup.py
    }

    python.add_ldflags  yes
    configure.ldflags-append   ${prefix}/lib/libevent1/libevent.dylib

    set compat_path [string replace ${python.pkgd} 0 [string length ${python.prefix}]-1 ${prefix}/lib/py${python.version}-cython-compat]
    build.env-append    PYTHONPATH=${compat_path}

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -m 755 -d ${destroot}${docdir}
        xinstall -m 644 -W ${worksrcpath} README \
           ${destroot}${docdir}
    }
    livecheck.type  none
}
