# -*- 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-pygrib
version             2.1.3
revision            0

categories-append   science
license             MIT
platforms           darwin
maintainers         {fastmail.fm:jswhit @jswhit} openmaintainer

description         Python interface to the Grib API library
long_description    ${description}

homepage            https://github.com/jswhit/pygrib

checksums           rmd160  bd075da11653613f5063ea4857c151efc749eaa8 \
                    sha256  a22552e2e58c9eb9b5750a2d5a8f055334ad2a6a4fb8a6d56261356196ebe651 \
                    size    21683768

python.versions     27 35 36 37 38 39

if {${name} ne ${subport}} {
    depends_build-append \
                    port:py${python.version}-cython \
                    port:py${python.version}-setuptools

    depends_lib-append \
                    port:py${python.version}-pyproj \
                    port:py${python.version}-numpy \
                    port:ecCodes

    # add explicit dependencies on libraries (these are dependencies of ecCodes).
    # fix building in trace mode and make it more explicit
    depends_lib-append \
                    port:jasper \
                    port:libpng \
                    port:openjpeg15 \
                    port:zlib

    build.env-append \
                    GRIBAPI_DIR=${prefix} \
                    PNG_DIR=${prefix} \
                    JASPER_DIR=${prefix} \
                    OPENJPEG_DIR=${prefix} \
                    ZLIB_DIR=${prefix}

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

    test.run        yes
    test.cmd        ${python.bin} test.py
    test.target

    livecheck.type  none
}
