# -*- 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        plumed plumed2 2.5.3 v
name                py-plumed
categories          python

platforms           darwin
categories-append   science
license             LGPL-3
maintainers         {gmail.com:giovanni.bussi @GiovanniBussi} openmaintainer

description         Python wrappers for plumed.
long_description    ${description} They allow the plumed library to be directly used from python.

homepage            http://www.plumed.org

checksums           rmd160  b8177e64c230f968a1c8bf0941b8a38ffa8f6476 \
                    sha256  75be9e8caeef2ded69b844be0eb12ad69e25c1ee9d193a179a5ba3e9b5cd09ab \
                    size    69826544

python.versions     27 36 37

# python setup is located in python subdir of plumed repository
worksrcdir  ${distname}/python

if {${name} ne ${subport}} {

# setup the wrappers so that by default they load MacPorts plumed library
    build.env-append    plumed_default_kernel=${prefix}/lib/libplumedKernel.dylib \
                        plumed_macports=yes

    depends_build-append    port:py${python.version}-cython \
                            port:py${python.version}-setuptools

    depends_lib-append      path:${prefix}/lib/libplumedKernel.dylib:plumed

    depends_test-append     port:py${python.version}-nose
    test.cmd                nosetests-${python.branch}
# needed since the module is placed in something like ${worksrcpath}/build/lib.macosx-10.11-x86_64-3.7
    test.env                PYTHONPATH=[glob -nocomplain ${worksrcpath}/build/lib*]
    test.target
    test.run                yes
}

notes "
PLUMED is linked with runtime binding. By setting the environment variable PLUMED_KERNEL\
to the path of libplumedKernel.dylib you can replace your own PLUMED library at runtime.\
By default, ${prefix}/lib/libplumedKernel.dylib is linked.
"