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

name                py-igraph
python.rootname     python-igraph
version             0.9.1
revision            0
categories-append   math science
platforms           darwin
license             GPL-2+

python.versions     36 37 38 39

maintainers         {snc @nerdling} {gmail.com:szhorvat @szhorvat} openmaintainer

description         Python interface to the igraph library.

long_description    Python interface to the igraph library for network analysis \
                    and graph theory. Also install py-cairocffi to enable \
                    visualization functionality.

homepage            https://igraph.org/python/

checksums           rmd160  d5916c79e7495fb43bcfc7bbdc71f982d0ff2312 \
                    sha256  f1895a83c57180f03c50fb77334a4d5029327aefee14f03381e10d34a1794410 \
                    size    3572314

if {${name} ne ${subport}} {
    compiler.cxx_standard   2011

    depends_lib-append      port:py${python.version}-texttable \
                            port:arpack \
                            port:glpk \
                            port:libxml2 \
                            port:SuiteSparse_CXSparse

    depends_build-append    port:py${python.version}-setuptools \
                            path:bin/cmake:cmake

    # python-igraph optionally makes use of these, and some tests depend on them.
    # If they are not installed, the corresponding tests will simply be skipped.
    depends_test-append     port:py${python.version}-numpy \
                            port:py${python.version}-scipy \
                            port:py${python.version}-pandas

    set extra_cmake_args {
        -DUSE_CCACHE=OFF
        -DBUILD_SHARED_LIBS=OFF
        -DIGRAPH_ENABLE_LTO=AUTO
        -DIGRAPH_GLPK_SUPPORT=ON
        -DIGRAPH_GRAPHML_SUPPORT=ON
        -DIGRAPH_USE_INTERNAL_ARPACK=OFF
        -DIGRAPH_USE_INTERNAL_BLAS=OFF
        -DIGRAPH_USE_INTERNAL_CXSPARSE=OFF
        -DIGRAPH_USE_INTERNAL_GLPK=OFF
        -DIGRAPH_USE_INTERNAL_GMP=ON
        -DIGRAPH_USE_INTERNAL_LAPACK=OFF
        -DBLA_VENDOR=Apple
    }

    build.env-append        IGRAPH_CMAKE_EXTRA_ARGS=[join $extra_cmake_args]

    pre-test {
        test.env    PYTHONPATH=[glob -nocomplain ${worksrcpath}/build/lib*]
    }

    test.run                yes
    test.cmd                python${python.branch} -m unittest
    test.target             

    livecheck.type          none
}
