# -*- 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

PortSystem              1.0
PortGroup               python 1.0

name                    py-pynds
version                 0.7.2
revision                3
categories              python science
platforms               darwin
maintainers             {aronnax @lpsinger}
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               sha1    0f856f8251c75925ffe4bd1867adf1153d6a28ea \
                        rmd160  191b7e8a6b2b5fa22111f05194ec8c961903f6dc

python.versions         27

if {${name} ne ${subport}} {

    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}"
        }
    }

    post-patch {
        reinplace       "s/boost_python/boost_python-mt/" ${worksrcpath}/setup.py
    }

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

}

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