# -*- 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-obspy
version             1.5.0
revision            0

categories-append   science
license             LGPL-3
maintainers         {petr @petrrr} openmaintainer

description         Python framework for processing seismological data
long_description    \
    ObsPy is an open-source project dedicated to provide a Python framework \
    for processing seismological data. It provides support for file formats \
    and signal processing routines which allow the manipulation, analysis \
    and visualization of seismological time series. The goal of the ObsPy \
    project is to facilitate rapid application development for seismology.

homepage            https://github.com/obspy/obspy/wiki/

checksums           rmd160  0ff1f18c2322f33feef72033e9373ed43fcf2bf1 \
                    sha256  88202d8a616dbe789a6c35bbf86d1008dd1b78b300cde92174a9d76d00af666e \
                    size    17869707

python.versions     310 311 312 313 314

# aic_simple.c: error: redefinition of ‘i’
compiler.c_standard 2011

if {${name} ne ${subport}} {
    # py-scipy is not universal
    universal_variant       no

    depends_lib-append      port:py${python.version}-decorator \
                            port:py${python.version}-lxml \
                            port:py${python.version}-matplotlib \
                            port:py${python.version}-numpy \
                            port:py${python.version}-scipy \
                            port:py${python.version}-requests \
                            port:py${python.version}-sqlalchemy

    depends_test-append     port:py${python.version}-packaging \
                            port:py${python.version}-pyproj \
                            port:py${python.version}-pytest \
                            port:py${python.version}-pytest-json-report

    test.run                yes

    # add manpages
    depends_build-append    port:help2man

    post-build {
        set libarch [glob -tail -directory ${worksrcpath}/build lib.*]
        set libsrc build/${libarch}/obspy/lib
        set libtgt ${worksrcpath}/obspy/lib

        # hack: link to built libraries to make scripts (and help2man) work
        foreach l [glob -tail -directory ${worksrcpath}/${libsrc} *.so] {
            ln -s ../../${libsrc}/${l} ${libtgt}/.
        }

        system -W ${worksrcpath} "${python.bin} setup.py --no-user-cfg build_man"
    }
    post-destroot {
        system -W ${worksrcpath} "${python.bin} setup.py --no-user-cfg install_man --prefix=${python.prefix} --root=${destroot}"
    }

    depends_run-append  port:${python.rootname}_select

    select.group    ${python.rootname}
    select.file     ${filespath}/${python.rootname}${python.version}

    notes-append "
To make this Python ${python.branch} version of ObsPy the default \
(i.e, use its script by their default names, e.g. obspy-runtests, etc.), run:

sudo port select --set ${select.group} [file tail ${select.file}]
    "
}
