# -*- 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-pint
version             0.26
revision            0

categories-append   science
license             BSD
maintainers         {mps @Schamschula} openmaintainer
description         Pint: a Python units library
long_description    Pint is Python module/package to define, operate and \
                    manipulate physical quantities: the product of a numerical \
                    value and a unit of measurement.  It allows arithmetic \
                    operations between them and conversions from and to \
                    different units.
homepage            https://pint.readthedocs.org/

supported_archs     noarch
platforms           {darwin any}

checksums           rmd160  367122038902c13ab999c94f4038da12d5259406 \
                    sha256  53c57e7aeced29d67c76e6819ec548fcd7b7778f21de074267d58673019460c5 \
                    size    272895

python.versions     310 311 312 313 314

python.pep517_backend \
                    hatch

if {${name} ne ${subport}} {
    depends_build-append \
                    port:py${python.version}-hatch-vcs

    depends_lib-append \
                    port:py${python.version}-flexcache \
                    port:py${python.version}-flexparser \
                    port:py${python.version}-platformdirs \
                    port:py${python.version}-typing_extensions

    depends_test-append \
                    port:py${python.version}-pytest \
                    port:py${python.version}-pytest-benchmark \
                    port:py${python.version}-pytest-cov \
                    port:py${python.version}-pytest-mpl \
                    port:py${python.version}-pytest-subtests

    variant babel description {build with babel support} {
        depends_lib-append \
                    port:py${python.version}-babel
    }

    variant matplotlib description {build with matplotlib support} {
        depends_lib-append \
                    port:py${python.version}-matplotlib
    }

    variant numpy description {build with numpy support} {
        depends_lib-append \
                    port:py${python.version}-numpy
    }

    if {${python.version} > 311} {
        variant optype description {build with optype support} {
            depends_lib-append \
                        port:py${python.version}-optype
        }
    }

    variant pint_pandas description {build with pint-pandas support, \
                                     has circular dependency on pint: \
                                     first install without this variant} {
        depends_lib-append \
                    port:py${python.version}-pint-pandas
    }

    variant scipy description {build with scipy support} {
        depends_lib-append \
                    port:py${python.version}-scipy
    }

    variant uncertainties description {build with uncertainties support} {
        depends_lib-append \
                    port:py${python.version}-uncertainties
    }

    variant xarray description {build with xarray support} {
        depends_lib-append \
                    port:py${python.version}-xarray
    }

    default_variants \
                    +babel \
                    +matplotlib \
                    +numpy \
                    +scipy \
                    +uncertainties \
                    +xarray

    if {${python.version} > 311} {
        default_variants \
                    +optype
    }

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

    test.run        yes
}
