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

github.setup            gpilab core-nodes 1.0.4 v
name                    py-gpilab-core
revision                1
python.versions         35 36 37
python.default_version  37
platforms               darwin
license                 {BSD LGPL-3+}
maintainers             {eborisch @eborisch} \
                        openmaintainer
description             Core GPI nodes.

long_description        The core nodes are a collection of basic data \
                        manipulation and visualization algorithms. 

homepage                http://gpilab.com

checksums \
    rmd160  f70a749d0938ad9c50a1c2ca00910f71322012fd \
    sha256  5f918c94f440250c1a269cd0f99ca4f99ce41fdbb28723f6894cf445c5ff139a \
    size    172215

if {${name} ne ${subport} } {
    depends_lib-append      port:py${python.version}-gpilab-framework \
                            port:py${python.version}-h5py \
                            port:py${python.version}-matplotlib

    patchfiles              spiral.diff

    use_configure no

    build { 
        set MODS [glob ${worksrcpath}/*/*_PyMOD.cpp]
        foreach mod ${MODS} {
            set D [file dirname ${mod}]
            set M [string range [file tail ${mod}] 0 end-10]
            ln -s ${worksrcpath} ${D}/core
            system -W ${D} "${prefix}/bin/gpi_make-${python.version} ${M}"
            delete ${D}/core
        }
        system -W ${worksrcpath} \
            "${prefix}/bin/python${python.branch} -O -m compileall ."
    }

    destroot {
        xinstall -d ${destroot}${prefix}/share/${subport}/
        xinstall -W ${worksrcpath} LICENSE COPYING COPYING.LESSER README.md \
            ${destroot}${prefix}/share/${subport}
     
        set PP ${destroot}${python.pkgd}
        xinstall -d ${PP}/gpi/node-libs
        file copy ${worksrcpath} ${PP}/gpi/node-libs/core

        delete ${PP}/gpi/node-libs/core/.gitattributes \
               ${PP}/gpi/node-libs/core/.gitignore

        fs-traverse pth ${PP}/gpi/node-libs/core {
            if {[file isfile ${pth}] && [string match *build/temp* ${pth}]} {
                delete ${pth}
            }
        }
    }
                            
    livecheck.type          none
}