# -*- 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-pyaudio
set my_name             PyAudio
version                 0.2.11
categories-append       audio
platforms               darwin
maintainers             {@Jakker NLnetLabs.nl:jaap} openmaintainer
license                 MIT

description             PyAudio provides Python bindings for PortAudio
long_description        PyAudio provides Python bindings for PortAudio, \
                        the cross-platform audio I/O library. With PyAudio, \
                        you can easily use Python to play and record audio \
                        on a variety of platforms.

homepage                http://people.csail.mit.edu/hubert/pyaudio/

master_sites            pypi:P/PyAudio/

distname                ${my_name}-${version}

checksums               rmd160  7a6bb88f56622555e77eb799e4ee74ff970b6e92 \
                        sha256  93bfde30e0b64e63a46f2fd77e85c41fd51182a4a3413d9edfaf9ffaa26efb74 \
                        size    37428

worksrcdir              PyAudio-${version}

python.versions         27 34 35 36 37

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

    depends_lib-append  port:portaudio

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

    python.link_binaries no

    post-destroot {
        xinstall -d ${destroot}${prefix}/share/doc/py${python.version}-pyaudio
        xinstall -m 640 {*}[glob ${worksrcpath}/examples/*] \
            ${destroot}${prefix}/share/doc/py${python.version}-pyaudio
        xinstall -d ${destroot}${prefix}/share/examples/py-pyaudio
        xinstall -m 640 {*}[glob ${worksrcpath}/examples/*] \
            ${destroot}${prefix}/share/examples/py-pyaudio
    }

    livecheck.type      none
} else {
    livecheck.type      pypi
    livecheck.name      ${my_name}
}