# -*- 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-nmrglue
version             0.11
revision            1

categories-append   science
platforms           {darwin any}
supported_archs     noarch
license             BSD
maintainers         {reneeotten @reneeotten} openmaintainer

description         A module for working with NMR data in Python
long_description    nmrglue is a module for working with NMR data in Python. \
                    When used with the Numpy, Scipy, and matplotlib packages \
                    nmrglue provides a robust interpreted environment for processing, \
                    analysing, and inspecting NMR data.

homepage            https://nmrglue.com

checksums           rmd160  d3d361f1ca9f62ddf497f91c0d38f635f7037aec \
                    sha256  9e740a02d34ce5df9eb0390274c6a5f37b4837d59139512a3dd169106a8e3fe1 \
                    size    205874

python.versions     310 311 312 313 314

conflicts           ${subport}-devel

patchfiles          PR224-v0.11.patch

foreach pver [list {*}${python.versions} ""] {
    subport py${pver}-nmrglue-devel {
        PortGroup       github 1.0

        github.setup    jjhelmus nmrglue 5a6c58e8077870185adf11d228ad71ced261c0fe
        github.tarball_from archive
        version         20260621-[string range ${github.version} 0 7]
        revision        0
        checksums       rmd160  09d78c5e0a5a44b6d591fde6234dbe002355e6a7 \
                        sha256  b46db74c046912780a981ce91b90efe50989d413c3009f6fb55ed11234baf095 \
                        size    14939210

        conflicts       py${pver}-nmrglue
        patchfiles-delete PR224-v0.11.patch

        if {${pver} ne ""} {
            livecheck.type  none
        } else {
            PortGroup   stub 1.0
        }
    }
}

if {${subport} ni [list ${name} ${name}-devel]} {
    # FIXME: issues reported by "ruff check * --select NPY201"
    # see: https://github.com/jjhelmus/nmrglue/pull/224
    patch.pre_args-replace  -p0 -p1

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

    test.run        yes
    test.args       --pyargs nmrglue

    post-destroot {
        xinstall -d ${destroot}${prefix}/share/doc/${subport}
        xinstall -m 0644 -W ${worksrcpath} TODO.txt LICENSE.txt INSTALL.txt \
            README.rst ${destroot}${prefix}/share/doc/${subport}
    }
}
