# $Id: Portfile,v 1.5 2005/07/04 09:20:25 michaelm Exp $

PortSystem               1.0
PortGroup                python24 1.0
name                     py-matplotlib
version                  0.82
categories-append        graphics math
maintainers              michaelm@opendarwin.org
description              matlab-like syntax for creating plots in python
long_description \
        Matplotlib is a pure python plotting library with the goal of making \
        publication quality plots using a syntax familiar to matlab users.  The \
        library uses Numeric for handling large data sets and supports a variety \
        of output backends

platforms                darwin

homepage                 http://matplotlib.sourceforge.net/
master_sites             sourceforge:matplotlib
distname                 matplotlib-${version}

checksums                md5 a5ef59a9eed934708eedef5a0125d8d8

depends_lib-append       port:freetype port:libpng \
                           port:antigraingeometry port:py-numarray \
                           port:py-numeric port:py-dateutil port:py-tz

patchfiles              patch-setupext.py.diff 



post-extract {
        if {![variant_isset gtk2]} {
                reinplace "s|^BUILD_GTKAGG\[\[:space:\]\]*=\[\[:space:\]\]*'auto'|BUILD_GTKAGG=0|" \
                  ${worksrcpath}/setup.py
        } else {
                reinplace "s|^BUILD_GTKAGG\[\[:space:\]\]*=\[\[:space:\]\]*'auto'|BUILD_GTKAGG=1|" \
                  ${worksrcpath}/setup.py
        }
        reinplace "s|^BUILD_TKAGG\[\[:space:\]\]*=\[\[:space:\]\]*'auto'|BUILD_TKAGG=0|" \
                ${worksrcpath}/setup.py
}

post-patch { reinplace "s|@@DPORTS_PREFIX@@|${prefix}|" ${worksrcpath}/setupext.py }

build.env                       MPLIB_BASE="${prefix}"

post-destroot {
        xinstall -m 755 -d ${destroot}/${prefix}/share/doc/${name} \
                ${destroot}/${prefix}/share/matplotlib
        xinstall -m 644 -W ${worksrcpath} API_CHANGES CHANGELOG INSTALL \
                INTERACTIVE KNOWN_BUGS README TODO \
                ${destroot}/${prefix}/share/doc/${name}
        file copy ${worksrcpath}/license \
                ${destroot}/${prefix}/share/doc/${name}
        file copy ${worksrcpath}/examples \
                ${destroot}/${prefix}/share/matplotlib
}

variant gtk2 {
        depends_lib-append      port:py-gtk2
}

