# -*- 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               github 1.0
PortGroup               python 1.0
PortGroup               mpi 1.0

github.setup            h5py h5py 3.16.0
github.tarball_from     releases
name                    py-h5py

# h5py needs to be re-built after hdf5 upgrades; it has its own version
# check included.
revision                1

checksums \
    rmd160  7e8b15d0604d38faa0fe78297b2d757a6717a29e \
    sha256  a0dbaad796840ccaa67a4c144a0d0c8080073c34c76d5a6941d6818678ef2738 \
    size    446526

license                 BSD
maintainers             {eborisch @eborisch} openmaintainer

description             Read and write HDF5 files from Python

long_description  \
    The h5py package provides both a high- and low-level interface to the \
    HDF5 library from Python. The low-level interface is intended to be a \
    complete wrapping of the HDF5 API, while the high-level component \
    supports  access to HDF5 files, datasets and groups using established \
    Python and NumPy concepts. \
    \n\nA strong emphasis on automatic conversion between Python (Numpy) \
    datatypes and data structures and their HDF5 equivalents vastly \
    simplifies the process of reading and writing data from Python.

homepage                https://www.h5py.org

python.versions         310 311 312 313 314

# Only check against releases.
github.livecheck.regex      {([0-9.]+)}

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

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

    build.env-append        HDF5_DIR=${prefix}
    destroot.env-append     HDF5_DIR=${prefix}

    post-destroot {
        xinstall -d ${destroot}${prefix}/share/doc/${subport}
        copy ${worksrcpath}/lzf/LICENSE.txt \
            ${destroot}${prefix}/share/doc/${subport}
    }

    # Add MPI support
    mpi.setup
    if {[mpi_variant_isset]} {
        build.env-append        DISTUTILS_DEBUG=1
        depends_lib-append      port:py${python.version}-mpi4py
        mpi.enforce_variant     hdf5 \
                                py${python.version}-mpi4py

        build.env-append        HDF5_MPI=ON
        destroot.env-append     HDF5_MPI=ON
    }
}
