PortSystem 1.0
PortGroup       python 1.0

name            py-pycg
version         0.14.1
revision        11
license         GPL-2
platforms       darwin
maintainers     {blair @blair}
description     Python bindings to NVIDIA's Cg package
long_description \
    This project provides Python bindings to NVIDIA's Cg runtime \
    library, enabling GPUs to be controlled from Python.

homepage        https://launchpad.net/pycg

python.versions 27

patchfiles      patch-darwin.conf.in.diff \
                patch-swig-files.diff

if {${name} ne ${subport}} {
    depends_build-append    port:swig-python
    depends_lib-append      port:cg-toolkit \
                            port:py${python.version}-numpy

    fetch.type      bzr
    bzr.url         lp:~callelejdfors/pycg/trunk
    bzr.revision    release-${version}

    worksrcdir      py-PyCg-${version}

    post-patch {
        file copy ${worksrcpath}/Darwin.conf.in ${worksrcpath}/Darwin.conf
        reinplace "s|@CC@|${configure.compiler}|g" ${worksrcpath}/Darwin.conf
        reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/Darwin.conf
        reinplace "s|@PYTHON_BRANCH@|${python.branch}|g" ${worksrcpath}/Darwin.conf
    }

    build.cmd       make
    build.target    all

    destroot {
        set cgdir ${destroot}${python.pkgd}/Cg
        xinstall -d ${cgdir}
        file copy ${worksrcpath}/Cg.py ${cgdir}/__init__.py
        file copy ${worksrcpath}/_Cg.so ${cgdir}/
        foreach f {LICENSE README} {
            file copy ${worksrcpath}/${f} \
                ${destroot}${prefix}/share/doc/${subport}
        }
    }
} else {
    livecheck.type  regex
    livecheck.url   https://cheeseshop.python.org/pypi/fpconst/
    livecheck.regex fpconst-(\[0-9\.\]+).tar.gz
}