# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           python 1.0

name                py-fabio
version             2024.9.0
revision            2

universal_variant   no
license             MIT
categories          python science
maintainers         {ill.fr:coquelleni @coquellen} openmaintainer

description         Reading and handling data from two-dimensional X-ray detectors.
long_description \
    FabIO is a Python module written for easy and transparent reading of raw \
    two-dimensional data from various X-ray detectors. The module provides \
    a function for reading any image and returning a fabioimage object which \
    contains both metadata (header information) and the raw data. All \
    fabioimage object offer additional methods to extract information about \
    the image and to open other detector images from the same data series.

homepage            https://github.com/silx-kit/fabio

checksums           rmd160  f8cf48300501d94db31d52922e2b3612fae02d54 \
                    sha256  f873df51f468531c11aae7e0cd88a14f221f4ef09431fbc5a6ca67b1ed47535b \
                    size    729407

python.versions     310 311 312 313
python.pep517_backend meson

if {${name} ne ${subport}} {
    patchfiles-append \
                    pyproject.toml.patch \
                    requirements.txt.patch

    depends_build-append \
                    port:ninja \
                    port:py${python.version}-cython \
                    port:py${python.version}-wheel \
                    port:py${python.version}-pyproject_metadata

    if {${python.version} < 311} {
        depends_build-append \
                    port:py${python.version}-tomli
    }

    depends_lib-append \
                    port:py${python.version}-numpy \
                    port:py${python.version}-h5py \
                    port:py${python.version}-hdf5plugin \
                    port:py${python.version}-lxml \
                    port:py${python.version}-Pillow

    test.run        yes

    build.env-append    CYTHON=${prefix}/bin/cython-${python.branch}

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} README.rst copyright \
            ${destroot}${docdir}
    }

    notes "If fabio_viewer is needed, install py${python.version}-pyqt4 or py${python.version}-pyqt5"
}
