# -*- 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
# $Id: Portfile 60005 2009-10-29 01:30:17Z jmr@macports.org $

PortSystem              1.0
PortGroup               python26 1.0

name                    py26-pynifti
version                 0.20090303.1
categories              python
platforms               darwin
maintainers             jameskyle
description             PyNIfTI aims to provide easy access to NIfTI images from within Python.
long_description        ${description}. It uses SWIG-generated wrappers for the NIfTI reference library and provides the NiftiImage class for Python-style access to the image data.

homepage                http://sourceforge.net/projects/niftilib
master_sites            sourceforge:niftilib

checksums           md5     6625c0db0ba4776c14327affa5c0098a \
                    sha1    96072c1b79c882a7a14461c9b48366a34f211e05 \
                    rmd160  b6e10b401f8e6585126426d207c9d6e9e393f382

depends_lib             port:py26-numpy \
                        port:nifticlib \
                        port:swig-python

depends_build           port:gcc43

build.env               CCFLAGS="-I${prefix}/include -L${prefix}/lib -I${prefix}/include/nifti"
configure.compiler      macports-gcc-4.3

distfiles               pynifti_${version}${extract.suffix}
worksrcdir              pynifti-${version}
patchfiles              patch-setup-py.diff
post-patch {
  reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/setup.py
}

pre-fetch {
  if {![llength [glob -nocomplain ${prefix}/share/swig/*/python/python.swg]]} {
    ui_error "The python variant of swig is not installed. Please run"
    ui_error "the following commands:"
    ui_error "$ sudo port uninstall swig"
    ui_error "$ sudo port install swig +python"
    error "python variant of swig required"
  }
}
livecheck.url http://sourceforge.net/export/rss2_projfiles.php?project=niftilib
livecheck.regex {pynifti_([0-9.]+).tar.gz}
