# -*- 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.4
revision            1

categories-append   science
license             MIT
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  bdb4e61224d5343e052e65de7882cc1ff61abb73 \
                    sha256  951a409eb3233dd95839dd77c0dbe4d8cbed8f21a4015b1047dec9edec65f545 \
                    size    21769773

python.versions     39 310

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

    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}

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