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

github.setup        PyMVPA PyMVPA 2.6.5 upstream/
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball

name                py-pymvpa
revision            4
categories-append   science math
license             MIT

python.versions     312
python.pep517       no

maintainers         {stromnov @stromnov} openmaintainer

description         MultiVariate Pattern Analysis (MVPA) in Python.

long_description    PyMVPA is a Python package intended to ease statistical \
                    learning analyses of large datasets. It offers \
                    an extensible framework with a high-level interface \
                    to a broad range of algorithms for classification, \
                    regression, feature selection, data import and export. \
                    While it is not limited to the neuroimaging domain, \
                    it is eminently suited for such datasets.

homepage            http://www.pymvpa.org

checksums           rmd160  6d208bb32a9546a7937595e8308665448cfb9f8a \
                    sha256  729f4ed734f47cfd1dcc32c09c8623e3d1d08962803c1e90e411e8f653a5bcac \
                    size    8161313

if {${name} ne ${subport}} {
    depends_build-append \
                        port:swig-python

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

    patchfiles-append   patch-setup.py.diff

    post-patch {
        reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/setup.py
    }

    build.args-append   --with-system-libsvm

    pre-destroot {
        xinstall -d ${worksrcpath}/build/py3k/bin
        xinstall -m 0755 {*}[glob ${worksrcpath}/bin/*] ${worksrcpath}/build/py3k/bin
    }

    notes "Upstream states: Python 3.X should work, but none of the core developers\
        are using it in production (yet), hence it should be considered as less tested."

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} README.rst Changelog \
            COPYING AUTHOR ${destroot}${docdir}

        # make scripts Python 3 compatible using the 2to3 tool
        foreach f [glob -type f -dir ${destroot}${python.prefix}/bin *] {
            system -W ${destroot}${python.prefix}/bin "2to3-${python.branch} -w -n ${f}"
        }
    }

    livecheck.type      none
} else {
    github.livecheck.regex  {([^"]+)}
}
