# -*- 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-jupyter
version             1.0.0
revision            3
categories-append   devel science
license             BSD
supported_archs     noarch
platforms           {darwin any}

python.versions     310 311 312 313 314

maintainers         {stromnov @stromnov} openmaintainer

description         Web application for interactive data science and scientific computing.
long_description    {*}${description}

homepage            https://jupyter.org

checksums           rmd160  60b8fbadf895ad211192356af59314d0812568e2 \
                    sha256  d9dc4b3318f310e34c82951ea5d6683f67bed7def4b259fafbfe4f1beb1d8e5f \
                    size    12916

if {${name} ne ${subport}} {
    python.pep517       no

    if {${python.version} >= 312} {
        depends_build-append \
                        port:py${python.version}-setuptools
    }

    depends_lib-append  port:py${python.version}-notebook \
                        port:py${python.version}-jupyter_core \
                        port:py${python.version}-jupyter_console \
                        port:py${python.version}-nbconvert \
                        port:py${python.version}-ipykernel \
                        port:py${python.version}-ipywidgets

    depends_run-append  port:jupyter_select

    patchfiles-append   patch-setup.py.diff

    # Remove QT support by default (to minimize average use case requirements)
    variant qtconsole description "Support for the Qt console" {
        depends_run-append  port:py${python.version}-qtconsole
    }

    post-destroot {
        # These files are installed both by this port and by the jupyter_core port
        delete \
            ${destroot}${python.pkgd}/jupyter.py \
            ${destroot}${python.pkgd}/__pycache__ \
    }

    select.group    jupyter
    select.file     ${filespath}/${subport}

    notes "
To make the Python ${python.branch} version of jupyter the one that is run when\
you execute the commands without a version suffix, e.g. 'jupyter-notebook', run:

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