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

PortSystem          1.0
PortGroup           python 1.0
PortGroup           wxWidgets 1.0

name                py-pyphant
version             1.0b3
revision            1
categories-append   science
description         python framework for analysing and managing scientific data
maintainers         fmf.uni-freiburg.de:servicegruppe.wissinfo \
                    {rowue @rowue} openmaintainer
long_description    The python framework pyphant allows for the creation \
                    and application of data flow models. The central idea \
                    of this approach is to encapsulate each data processing \
                    step in one unit which is called a worker. \
                    A worker receives input via sockets and provides the \
                    results of its data processing via plugs. These can be \
                    inserted into other workers' sockets. The resulting \
                    directed graph is called a recipe. Classes for these \
                    objects comprise the Pyphant core. \
                    To implement actual processing steps, Pyphant relies on \
                    third party plug-ins, also referred to as toolboxes, \
                    which extend the basic worker class, e.g. \
                    py-pyphant-imageprocessing. \
                    On top of the core, Pyphant offers a data exchange layer \
                    on basis of numpy arrays which facilitates the \
                    interoperability of the workers and fully supports \
                    physical quantities with errors and units. \
                    The third layer is a graphical user interface \
                    allowing for the interactive construction of recipes \
                    as well as the calculation and visualization of data \
                    from any worker in the recipe.

homepage            http://www.fmf.uni-freiburg.de/service/servicegruppen/sg_wissinfo/projekte/Pyphant
license             BSD

platforms           darwin

# py26-scipy is not universal
universal_variant   no

distname            pyphant
master_sites        sourceforge:pyphant

use_configure       no

python.versions     27

if {${name} ne ${subport}} {
    depends_build-append    port:py${python.version}-setuptools

    if [string match {py??-pyphant-*} ${subport}] {
        depends_lib-append  port:py${python.version}-pyphant
    }
}

foreach python.vers ${python.versions} {
    subport py${python.vers}-${distname} {
        PortGroup           app 1.0
        set python.version  ${python.vers}
        worksrcdir          ${distname}-${version}
        distfiles           ${distname}-${version}${extract.suffix}
        checksums           rmd160  aa56f61a73300651730f867b249264e2ca63d200 \
                            sha256  c873352467f9ecf96fac03082e3cbc4153d13f8103e5339e608897884867db53

        app.name            pyphant-${python.branch}
        app.executable      pyphant-${python.branch}
        app.icon            ${filespath}/Pyphant.icns

        wxWidgets.use       wxPython-3.0

        depends_lib-append  port:py${python.version}-numpy \
                            port:py${python.version}-scipy \
                            port:py${python.version}-tables \
                            port:py${python.version}-matplotlib \
                            port:py${python.version}-simplejson \
                            port:py${python.version}-paste \
                            port:py${python.version}-mx-base \
                            port:py${python.version}-sogl \
                            port:py${python.version}-wxpython-3.0

        depends_run-append  port:py${python.version}-configobj \
                            port:py${python.version}-tornado

        pre-destroot {
            file copy ${filespath}/pyphant.quartz ${destroot}${prefix}/bin
            file rename ${destroot}${prefix}/bin/pyphant.quartz ${destroot}${prefix}/bin/pyphant-${python.branch}
            reinplace "s|@PREFIX@|${prefix}|" ${destroot}${prefix}/bin/pyphant-${python.branch}
            reinplace "s|@PYTHONBRANCH@|${python.branch}|" ${destroot}${prefix}/bin/pyphant-${python.branch}
        }
    }

    subport py${python.vers}-${distname}-fmf {
        set python.version  ${python.vers}
        description         Full-Metadata Format toolbox for py${python.version}-pyphant
        long_description    This toolbox enables the py${python.version}-pyphant framework to read \
                            files written in the Full-Metadata Format (FMF). \
                            See http://arxiv.org/abs/0904.1299 for an introduction \
                            to the FMF. There is also support for writing files \
                            in the FMF, although this feature is currently not \
                            accessible from the pyphant GUI.

        distname            ${distname}.fmf-${version}
        checksums           rmd160  42d70609400f636b2c4ffced5e5f2192f76ac4ad \
                            sha256  8ef7acf200f6a7a8805d4f91680fd771129f1c68178d8d710b7a9a322267cdfc
    }

    subport py${python.vers}-${distname}-imageprocessing {
        set python.version  ${python.vers}
        description         imageprocessing toolbox for py${python.version}-pyphant
        long_description    This toolbox provides a set of imageprocessing workers, \
                            i.e. encapsulated data processing steps for the \
                            py${python.version}-pyphant framework. Currently there are 22 workers \
                            providing operations varying from simple functions like \
                            'inversion' or some scipy.ndimage filters to more complex \
                            operations, e.g. auto-focus evaluation of transmitted \
                            light microscopy photographs.

        distname            ${distname}.imageprocessing-${version}
        checksums           rmd160  e4d160989c0e5b07528577052dd451b47828a7d4 \
                            sha256  9e1619cf3abbe94ce785b9b5b02383b5a31f9ba2ef0bc75922c785195620229f
        revision            2

        # numpy and scipy are already dependencies of pyphant
        depends_lib-append  port:py${python.version}-Pillow \
                            port:py${python.version}-numpy \
                            port:py${python.version}-scipy

        patchfiles          Pillow_patch-setup.py.diff \
                            Pillow_patch-pyphant.imageprocessing.egg-info-requires.txt.diff

        variant pil description {Use PIL instead of Pillow as the imaging library} {
            depends_lib-replace    port:py${python.version}-Pillow port:py${python.version}-pil

            patchfiles-delete      Pillow_patch-setup.py.diff
            patchfiles-delete      Pillow_patch-pyphant.imageprocessing.egg-info-requires.txt.diff
        }

        if {![catch {set pil_installed [lindex [registry_active py${python.version}-pil] 0]}]} {
            default_variants    +pil
        }
    }

    subport py${python.vers}-${distname}-osc {
        set python.version  ${python.vers}
        description         organic solar cells toolbox for py${python.version}-pyphant
        long_description    This Toolbox offers various workers for the \
                            analysis of organic solar cells. It is joined \
                            work with Kristian O. Sylvester-Hvid from the \
                            Risø National Laboratory for Sustainable Energy. \
                            The main purpose at the moment is the generation \
                            of height maps for polymer based solar cells. \
                            The developed workers are however applicable in \
                            a wide range of problems.

        distname            ${distname}.osc-${version}
        checksums           rmd160  1093b2a9b036648f76089f5d1b919186b7a2dd2c \
                            sha256  ba573aaa5cb78c4f692798e2c6845f4a0b11b99d721905be56c47db1885d3e67

        depends_lib-append  port:py${python.version}-numpy \
                            port:py${python.version}-scipy \
                            port:py${python.version}-matplotlib
    }

    subport py${python.vers}-${distname}-statistics {
        set python.version  ${python.vers}
        description         statistics toolbox for py${python.version}-pyphant
        long_description    This toolbox provides the histogram worker which enables \
                            the py${python.version}-pyphant framework to obtain histograms from \
                            array-like data.

        distname            ${distname}.statistics-${version}
        checksums           rmd160  893f87f8d9b206a71a963ba30be37e2fd4bb002f \
                            sha256  ae71e825508fe74c88693108a7bc0612416fdabb1e71442c815ccbfe2b37c7cb

        depends_lib-append  port:py${python.version}-numpy \
                            port:py${python.version}-scipy
    }

    subport py${python.vers}-${distname}-tools {
        set python.version  ${python.vers}
        description         tools toolbox for py${python.version}-pyphant
        long_description    This toolbox currently provides two workers for the \
                            py${python.version}-pyphant framework. These workers can be integrated \
                            in a data flow model and simply serve as data sources for \
                            data that is managed by a py${python.version}-pyphant core module called \
                            KnowledgeManager (KM). The KM accumulates metadata in a \
                            sqlite3 database and the above mentioned workers present \
                            parameters to perform a metadata search and finally \
                            load and provide the data that matched the search.

        distname            ${distname}.tools-${version}
        checksums           rmd160  7eabbd970968bd118a9fd93670bf79e48790d130 \
                            sha256  1d97e9b5b798047aa529148e8c5356cdbc61a3333394b5e72e8cf6b429c3b23f
    }
}