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

name                py-pcapy
version             0.11.4
revision            0
categories-append   net
license             Apache-1.1
maintainers         nomaintainer

description         python interface to libpcap

long_description    Pcapy is a Python extension module that interfaces with \
                    the libpcap packet capture library. Pcapy enables python \
                    scripts to capture packets on the network.

platforms           darwin

homepage            https://github.com/SecureAuthCorp/pcapy/

checksums           rmd160  558694f7315b97a09a7d7164c2d042f6a0899aee \
                    sha256  aa239913678d7ba116e66057a37f914de7726aecd11d00db470127df115c4e78 \
                    size    37045

python.versions     27 36

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

    depends_lib-append \
                    port:libpcap

    post-extract {
        fs-traverse item ${worksrcpath} {
            if {[file isdirectory ${item}]} {
                file attributes ${item} -permissions a+rx
            } elseif {[file isfile ${item}]} {
                file attributes ${item} -permissions a+r
            }
        }
    }

    build.env       "CPPFLAGS=-I${prefix}/include -L${prefix}/lib" \
                    CFLAGS=-I${prefix}/include \
                    LDFLAGS=-L${prefix}/lib

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} LICENSE README \
            ChangeLog ${destroot}${docdir}
    }

    test.run        yes
    python.test_framework
    test.cmd        ${python.bin} tests/pcapytests.py
}
