# -*- 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
# $Id: Portfile 120071 2014-05-14 22:28:52Z stromnov@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-scikit-learn
version             0.14.1
revision            1
categories-append   science
platforms           darwin
license             BSD

# Stealth update for 0.14.1
dist_subdir         ${name}/${version}_1

python.versions     26 27 32 33 34

maintainers         stromnov openmaintainer

description         Easy-to-use and general-purpose machine learning in Python

long_description    Scikit-learn integrates machine learning algorithms \
                    in the tightly-knit scientific Python world, building upon \
                    numpy, scipy, and matplotlib. As a machine-learning module, \
                    it provides versatile tools for data mining and analysis \
                    in any field of science and engineering.

homepage            http://scikit-learn.org/
master_sites        http://pypi.python.org/packages/source/s/scikit-learn/

distname            scikit-learn-${version}

checksums           rmd160  a372e7d1e8eb09be6fd1b4d791f05e049f5a87f4 \
                    sha256  34821b8f460bdb7aba8eb882353bacbd01671bfb8057649ffcdce7f7ffa4a21d

if {${name} ne ${subport}} {
    depends_lib-append  port:py${python.version}-numpy \
                        port:py${python.version}-scipy

    # Cythonized files in scikit-learn 0.14.1 are incompatible with Python 3.4
    # See https://github.com/scikit-learn/scikit-learn/issues/3114
    if {${subport} eq "py34-scikit-learn"} {
        depends_build-append    \
                            port:py34-cython

        patchfiles-append   patch-sklearn_neighbors_binary_tree.pxi.diff

        post-configure {
            fs-traverse item ${worksrcpath} {
                if {[file isfile ${item}] && [file extension ${item}] eq ".pyx"} {
                    system "echo Cythoning ${item}...; \"${prefix}/bin/cython-3.4\" \"${item}\""
                }
            }
        }
    }

    livecheck.type      none
} else {
    livecheck.type      regex
    livecheck.url       ${master_sites}
    livecheck.regex     "scikit-learn-(\\d+(?:\\.\\d+)*)${extract.suffix}"
}
