# -*- 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           select 1.0

name                py-gdal
# keep version in sync with gdal; rebuilt after gdal update
version             3.11.0
revision            0

categories-append   gis
license             MIT
maintainers         {petr @petrrr} {yahoo.com:n_larsson @nilason} openmaintainer

description         GDAL: Geospatial Data Abstraction Library
long_description    This Python package and extensions are a number of tools for programming \
                    and manipulating the GDAL Geospatial Data Abstraction Library.

homepage            https://www.gdal.org

checksums           rmd160  6e7a4477d1db061e6983d9b4886cfbd8ffc320c9 \
                    sha256  ac59ccfe291d3ce4f6a9a3eed17da3777bc3bae970ce27217d4fa85db98650f8 \
                    size    877693

python.versions     39 310 311 312 313

if {${name} ne ${subport}} {
    compiler.cxx_standard   2011
    compiler.thread_local_storage yes

    # Setting build.cmd manually may be removed when py-numpy is >= 2
    build.cmd "${python.bin} -m build --no-isolation --skip-dependency-check"

    depends_run-append \
                    port:gdal_select

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

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

        set destroot_sel_dir ${destroot}${prefix}/etc/select/
        reinplace -q "s|@PYVER@|${python.branch}|" ${destroot_sel_dir}/gdal/py-gdal
        move ${destroot_sel_dir}/gdal/py-gdal ${destroot_sel_dir}/gdal/py${python.version}-gdal
    }

    select.group    gdal
    select.file     ${filespath}/py-gdal
}
