# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 57375 2009-09-10 08:16:41Z ryandesign@macports.org $

PortSystem       1.0
PortGroup        python24 1.0

name             py-scientific
version          2.6.1
categories       python science
platforms        darwin
maintainers      nomaintainer
description      Scientific Python
long_description ScientificPython is a collection of Python modules that \
                 are useful for scientific computing.
homepage         http://dirac.cnrs-orleans.fr/plone/software/scientificpython
master_sites     http://sourcesup.cru.fr/frs/download.php/1674/
distname         ScientificPython-${version}

checksums        md5 1b93026dd02529607131e5b0b83aeec4 \
                 sha1 81adf95e2c6060f64d3712dba8f4a5b43402e179 \
                 rmd160 83ddfa7123f33990b2baf293bdac4d37da8abeb6

depends_lib      port:netcdf \
                 port:py-numeric

build.env    	 CPPFLAGS="-I${prefix}/include/python2.4 \
       		     -I${worksrcpath}/Include" \
                 NETCDF_PREFIX=${prefix}

post-destroot {
    move ${destroot}${prefix}/bin/bsp_virtual \
        ${destroot}${prefix}/bin/bsp_virtual2.4
}

platform macosx {
    post-extract {
        copy -force ${filespath}/customize.py-macosx ${worksrcpath}/customize.py
    }
}

platform puredarwin {
    post-extract {
        copy -force ${filespath}/customize.py-puredarwin ${worksrcpath}/customize.py
    }
}

variant mpi description {Enable lammpi support} {
    depends_lib-append  port:lammpi
    post-build {
        reinplace "s|%s %s -o mpipython|${prefix}/bin/%s -o mpipython -I${prefix}/include/python2.4 -I${worksrcpath}/Include|g" \
			${worksrcpath}/Src/MPI/compile.py
        reinplace "s|-L%s -lpython%s|-L/Library/Frameworks/Python.framework/Versions/2.4/lib -L%s -lpython.%s|g" \
			${worksrcpath}/Src/MPI/compile.py
        reinplace "s|cfgDict\\\[\'LINK|#cfgDict\\\[\'LINK|g" \
			${worksrcpath}/Src/MPI/compile.py
        system "cd ${worksrcpath}/Src/MPI && ${prefix}/bin/python2.4 compile.py"
    }

    post-destroot {
        xinstall ${worksrcpath}/Src/MPI/mpipython ${destroot}${prefix}/bin
    }
}

livecheck.type  regex
livecheck.url   http://sourcesup.cru.fr/projects/scientific-py/
livecheck.regex {<td>(\d+(?:\.\d+)*)}
