# -*- 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-blosc2
version             2.5.1
revision            2

categories-append   archivers devel
maintainers         nomaintainer
license             BSD

python.versions     39 310 311 312 313

description         Python wrapper for Blosc2

long_description    A Python wrapper for the extremely fast Blosc2 \
                    compression library

homepage            https://pypi.python.org/pypi/blosc2/

checksums           rmd160  20e2752d657c94699dd0a49a66a282a1c086d691 \
                    sha256  47d5df50e7286edf81e629ece35f87f13f55c13c5e8545832188c420c75d1659 \
                    size    4676483

if {$subport ne $name} {
    depends_build-append \
                        port:py${python.version}-scikit-build \
                        port:py${python.version}-cython \
                        path:bin/cmake:cmake \
                        port:ninja \
                        port:py${python.version}-oldest-supported-numpy \
                        path:bin/pkg-config:pkgconfig

    depends_lib-append  port:blosc2 \
                        port:py${python.version}-numpy \
                        port:py${python.version}-ndindex \
                        port:py${python.version}-msgpack \
                        port:py${python.version}-cpuinfo

    patchfiles          patch-pyproject.toml.diff \
                        patch-setup.py.diff

    # https://github.com/Blosc/python-blosc2/issues/320
    patchfiles-append   patch-gnu99.diff

    if {!([variant_exists universal] && [variant_isset universal])} {
        # https://github.com/scikit-build/scikit-build/issues/1123
        build.env-append    CMAKE_OSX_ARCHITECTURES=${configure.build_arch}
    }

    test.run            yes
    test.cmd            ${python.bin} -m pytest

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -m 755 -d ${destroot}${docdir}
        xinstall -m 644 -W ${worksrcpath} LICENSE.txt README.rst \
            RELEASE_NOTES.md \
            ${destroot}${docdir}
    }
}
