# -*- 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-sunpy
version             8.0.0
revision            0

categories-append   science
license             BSD
maintainers         {mps @Schamschula} openmaintainer
description         SunPy is an open-source Python library for Solar Physics data \
                    analysis and visualization.
long_description    {*}${description}
homepage            https://sunpy.org

checksums           rmd160  c372c9923c2e22a7b982ad57d1524d1c33a8313d \
                    sha256  a675c184d5dbe455495242e446e7c10db0bbe78bbed8920e327d293ae1fb689d \
                    size    4962896

python.versions     310 311 312 313 314

if {${name} ne ${subport}} {
    depends_build-append \
                    port:py${python.version}-extension-helpers \
                    port:py${python.version}-setuptools_scm

    depends_lib-append \
                    port:py${python.version}-astropy \
                    port:py${python.version}-fsspec \
                    port:py${python.version}-numpy \
                    port:py${python.version}-packaging \
                    port:py${python.version}-parfive \
                    port:py${python.version}-pyerfa

    if {${python.version} < 311} {
        version     6.0.5
        revision    1

        checksums   rmd160  30c0cab6ee6a1413ec9a2af507997c2cfb0f1c74 \
                    sha256  050c2af6f2ace906471a552f6c2094406b695aa140d9b25e8cfcac718c30e92e \
                    size    3755333

        # Note:
        # the asdf variant requires py311-obspy which is missing dependencies.
        variant asdf {
            depends_lib-append \
                        port:py${python.version}-pyasdf
        }
    } else {
        variant asdf {
            depends_lib-append \
                        port:py${python.version}-asdf-astropy
        }
    }

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

    variant database {
        depends_lib-append \
                    port:py${python.version}-sqlalchemy
    }

    variant image {}

    variant jpeg2000 {
        depends_lib-append \
                    port:py${python.version}-glymur
    }

    variant jupyter {
        depends_lib-append \
                    port:py${python.version}-itables \
                    port:py${python.version}-ipywidgets
    }

    variant net {
        depends_lib-append \
                    port:py${python.version}-beautifulsoup4 \
                    port:py${python.version}-dateutil \
                    port:py${python.version}-drms \
                    port:py${python.version}-tqdm \
                    port:py${python.version}-zeep
    }

    variant opencv {
        depends_lib-append \
                    port:py${python.version}-opencv4
    }

    variant scikit_image {
        depends_lib-append \
                    port:py${python.version}-scikit-image
    }

    # Note:
    # the spice variant is only available for the x86_64 platform
    variant spice {
        depends_lib-append \
                    port:py${python.version}-spiceypy
    }

    variant timeseries {
        depends_lib-append \
                    port:py${python.version}-cdflib \
                    port:py${python.version}-h5netcdf \
                    port:py${python.version}-h5py    }

    variant visualization {}

    if {[variant_isset map] || [variant_isset timeseries] \
            || [variant_isset visualization]} {
        depends_lib-append \
                    port:py${python.version}-matplotlib
    }

    if {[variant_isset map] || [variant_isset visualization]} {
        depends_lib-append \
                    port:py${python.version}-mpl-animators
    }

    if {[variant_isset net] || [variant_isset timeseries]} {
        depends_lib-append \
                    port:py${python.version}-pandas
    }

    if {[variant_isset image] || [variant_isset map]} {
        depends_lib-append \
                    port:py${python.version}-scipy
    }

    default_variants    +database +image +jpeg2000 +jupyter +map +net +scikit_image \
                        +timeseries +visualization
}
