# -*- 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.7.0 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  607a3908f8548f88ac14c990e38a6fe99b40c3ea \
                    sha256  ab61d82cba0b67e7ce7c05be1dc84fbfd686d73ac8747dcbb1f0e550cdbd743b \
                    size    98830315

python.versions     36 37 38 39

# 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 \
                            port:py${python.version}-numpy \
                            port:py${python.version}-pandas

    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.
"
