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

name                py-pandas
version             2.2.1
revision            0
categories-append   science
license             BSD

python.versions     38 39 310 311 312
python.pep517_backend   meson

maintainers         {stromnov @stromnov} openmaintainer

description         Powerful data structures for data analysis and statistics

long_description    {*}${description}

homepage            https://pandas.pydata.org

checksums           rmd160  0597e33564e666117eab6957838304ea39cc0fe0 \
                    sha256  0ab90f87093c13f3e8fa45b48ba9f39181046e8f3317d3aadb2fffbb1b978572 \
                    size    4395256

# error: use of undeclared identifier 'signbit'; did you mean 'std::signbit'?
compiler.blacklist-append \
                    {clang < 600} *gcc-4.*

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

    depends_lib-append  port:py${python.version}-numpy \
                        port:py${python.version}-dateutil \
                        port:py${python.version}-tz \
                        port:py${python.version}-pytzdata

    if {${python.version} eq 38} {
        version             1.5.3
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  7119e0a0bb95117c9323840bdcf77ad56371cb04 \
                            sha256  74a3fd7e5a7ec052f183273dc7b0acd3a863edf7520f5d3a1765c04ffdb3b0b1 \
                            size    5203060
        python.pep517_backend   setuptools
        post-patch {
            reinplace {s|oldest-supported-numpy>=2022\.8\.16|numpy|g} ${worksrcpath}/pyproject.toml
        }

        set compat_path [string replace ${python.pkgd} 0 [string length ${python.prefix}]-1 ${prefix}/lib/py${python.version}-cython-compat]
        build.env-append    PYTHONPATH=${compat_path}

        depends_build-append \
                            port:py${python.version}-cython-compat
        depends_build-delete \
                            port:py${python.version}-versioneer
        depends_lib-delete  port:py${python.version}-pytzdata
    } else {
        patchfiles-append   patch-pyproject.toml.diff
        build.env-append    CYTHON=${prefix}/bin/cython-${python.branch}
        build.env-append    PATH=${python.prefix}/bin:$::env(PATH)
    }

    livecheck.type      none
}
