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

github.setup        openslide openslide-python 1.4.6 v
name                py-openslide
revision            0
categories-append   graphics
license             LGPL-2.1 MIT BSD
maintainers         {bgilbert @bgilbert}

python.versions     310 311 312 313 314

description         Python binding for the OpenSlide library.

long_description    OpenSlide Python allows the OpenSlide library to be \
                    used from Python programs.  OpenSlide provides a simple \
                    interface for reading whole-slide images, also known as \
                    virtual slides, which are high-resolution images used in \
                    digital pathology.  These images can occupy tens of \
                    gigabytes when uncompressed, and so cannot be easily \
                    read using standard tools or libraries, which are \
                    designed for images that can be comfortably uncompressed \
                    into RAM.  Whole-slide images are typically \
                    multi-resolution\; OpenSlide allows reading a small \
                    amount of image data at the resolution closest to a \
                    desired zoom level.

homepage            https://openslide.org/
github.tarball_from releases
distname            openslide_python-${version}
use_xz              yes

checksums           rmd160  4b2cb12b6a63276ecc94aa66acce3b6b47578b28 \
                    sha256  d5019f4e9068bee8b2f69d13870c51c2f32275aeec7396b966561419842a3473 \
                    size    344016

if {${name} ne ${subport}} {
    depends_build       port:py${python.version}-sphinx
    # py-flask is only needed for the examples.
    depends_lib-append  port:openslide \
                        port:py${python.version}-flask \
                        port:py${python.version}-Pillow

    test.run            yes

    post-build {
        system -W ${worksrcpath} \
            "${prefix}/bin/sphinx-build-${python.branch} -d build/doctrees doc build/html"
    }

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -m 644 -W ${worksrcpath} \
            CHANGELOG.md \
            COPYING.LESSER \
            ${destroot}${docdir}
        file copy ${worksrcpath}/build/html ${destroot}${docdir}
        # Empty examples directory created by python portgroup
        file delete ${destroot}${docdir}/examples
        file copy ${worksrcpath}/examples ${destroot}${docdir}
    }
}
