# -*- 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
python.rootname     Pint
version             0.13
revision            0

categories-append   science
platforms           darwin
supported_archs     noarch
license             BSD
maintainers         {g5pw @g5pw} 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/

checksums           rmd160  6462e1438dc6b8fc99dc6706b25bbb01efb520e8 \
                    sha256  13fa35ffa3ddf53161b4304917085687950e0de461bcdd4d65cdee11a43d7fb2 \
                    size    250868

python.versions     27 35 36 37 38 39

if {${name} ne ${subport}} {
    if {${python.version} in "27 35"} {
        version     0.9
        revision    0
        checksums   rmd160  84046fb4f727d8ce49d324dd159431c7e76ae575 \
                    sha256  32d8a9a9d63f4f81194c0014b3b742679dce81a26d45127d9810a68a561fe4e2 \
                    size    178344

        if {${python.version} eq 27} {
            depends_lib-append \
                        port:py${python.version}-funcsigs
        }
    } else {
        depends_build-append \
                    port:py${python.version}-setuptools_scm

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

        if {${python.version} < 38} {
            depends_lib-append \
                    port:py${python.version}-importlib-metadata
        }

        depends_test-append \
                    port:py${python.version}-pytest

        test.cmd    py.test-${python.branch}
        test.target
    }

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

    test.run        yes
    test.env        PYTHONPATH=${worksrcpath}/build/lib

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

        if {${python.version} in "27 35"} {
            xinstall -m 0644 -W ${worksrcpath} README ${destroot}${docdir}
        } else {
            xinstall -m 0644 -W ${worksrcpath} README.rst ${destroot}${docdir}
        }
    }

    livecheck.type none
}
