# -*- 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 92633 2012-05-02 21:31:16Z jmr@macports.org $

PortSystem              1.0
PortGroup               python 1.0

name                    py-pynds
version                 0.7.0
categories              python science
platforms               darwin
maintainers             aronnax ram
description             Network Data Server Client Python Wrapper
long_description \
    Python wrapper for accessing streamed LIGO data using the Network \
    Data Server version 2.

homepage                http://www.lsc-group.phys.uwm.edu/daswg/
master_sites            ${homepage}download/software/source/
distname                pynds-${version}
checksums               md5     fb5ad5fa944c9f5252c8385a55ac76eb \
                        sha1    79d730534ac7fac2280f8b027f2b3017c5bfb323 \
                        rmd160  e629494a1dabdf747845e0b69faa87746c3a2a37

python.versions         25 26 27
python.default_version  27

if {${subport} != ${name}} {

    depends_lib-append  port:nds2-client \
                        port:boost \
                        port:py${python.version}-numpy

    if { ![file exists ${prefix}/lib/libboost_python-mt.dylib] } {
        depends_lib-delete port:boost
    }

    pre-fetch {
        if { ![file exists ${prefix}/lib/libboost_python-mt.dylib] } {
            if { [file exists ${prefix}/lib/libboost_system-mt.dylib] } {
                ui_error "
****
**** PyNDS requires port boost installed with variant +python${python.version}.
**** Please do the following then try installing ${name} again:
****
****     sudo port install boost +python${python.version}
****

"
            } else {
                ui_error "
****
**** PyNDS requires port boost installed with variant +python${python.version}.
**** Please do the following then try installing ${name} again:
****
****     sudo port install boost +python${python.version}
****

"
            }
            error       "${name} requires boost +python${python.version}"
        }
    }

    build.env           PYTHON_CFLAGS="-I${prefix}/include/boost" \
                        CFLAGS="-I${prefix}/include/boost"

}

if {${name} == ${subport}} {
    livecheck.type      regex
    livecheck.url       ${master_sites}
    livecheck.regex     {pynds-(\d+(?:\.\d+)*).tar.gz}
} else {
    livecheck.type      none
}
