# -*- 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-ipython
version             7.5.0
revision            0
categories-append   devel science
platforms           darwin
license             BSD
supported_archs     noarch

python.versions     27 34 35 36 37

maintainers         {aronnax @lpsinger} {stromnov @stromnov} openmaintainer

description         An enhanced interactive Python shell.
long_description    ${description}

homepage            https://ipython.org/
master_sites        pypi:[string index ${python.rootname} 0]/${python.rootname}

distname            ${python.rootname}-${version}

checksums           rmd160  91f1116a225111856d03ea676dfa86a1da009967 \
                    sha256  e840810029224b56cd0d9e7719dc3b39cf84d577f8ac686547c8ba7a06eeab26 \
                    size    5118610

if {${name} ne ${subport}} {
    set python_major [string range ${python.version} 0 end-1]

    depends_run-append  port:ipython_select \
                        port:ipython${python_major}_select

    depends_lib-append  port:py${python.version}-appnope \
                        port:py${python.version}-backcall \
                        port:py${python.version}-decorator \
                        port:py${python.version}-jedi \
                        port:py${python.version}-pexpect \
                        port:py${python.version}-pickleshare \
                        port:py${python.version}-prompt_toolkit \
                        port:py${python.version}-pygments \
                        port:py${python.version}-setuptools \
                        port:py${python.version}-traitlets

    if {${python.version} eq 27} {
        version             5.8.0
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  8f11c03f31ed7d11d566f13eeda5cdcec8c07105 \
                            sha256  4bac649857611baaaf76bc82c173aa542f7486446c335fe1a6c05d0d491c8906 \
                            size    4977824

        depends_lib-append  port:py${python.version}-backports-shutil_get_terminal_size \
                            port:py${python.version}-pathlib2 \
                            port:py${python.version}-gnureadline \
                            port:py${python.version}-simplegeneric

        depends_lib-delete  port:py${python.version}-backcall \
                            port:py${python.version}-jedi

    } elseif {${python.version} eq 34} {
        version             6.5.0
        revision            1
        distname            ${python.rootname}-${version}
        checksums           rmd160  00bca7a24732647ff65feee9c75849aaa827ba39 \
                            sha256  b0f2ef9eada4a68ef63ee10b6dde4f35c840035c50fd24265f8052c98947d5a4 \
                            size    5084444

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

    variant parallel description "Support for parallel computing (deprecated variant)" {
        notes-append "
To enable support for parallel computing please install py${python.version}-ipyparallel port:

    sudo port install py${python.version}-ipyparallel
    "
    }

    variant pyqt4 conflicts pyside description "Support for the Qt console using pyqt4 (deprecated variant)" {
        notes-append "
To enable support for the Qt console please install py${python.version}-pyqt4 and py${python.version}-qtconsole ports:

    sudo port install py${python.version}-pyqt4
    sudo port install py${python.version}-qtconsole
    "
    }

    variant pyside conflicts pyqt4 description "Support for the Qt console using pyside (deprecated variant)" {
        notes-append "
To enable support for the Qt console please install py${python.version}-pyside and py${python.version}-qtconsole ports:

    sudo port install py${python.version}-pyside
    sudo port install py${python.version}-qtconsole
    "
    }

    variant terminal description "Support for the terminal emulation (deprecated variant)" {}

    variant notebook description "Support for IPython HTML notebook (deprecated variant)" {
        notes-append "
To enable support for the notebook please install py${python.version}-notebook port:

    sudo port install py${python.version}-notebook
    "
    }

    select.entries      [list ipython py${python.version}-ipython py${python.version}-ipython] \
                        [list ipython${python_major} py${python.version}-ipython py${python.version}-ipython]

    notes-append "
Please note that since version 4.0 IPython was refactored and splitted across several packages under new project named Jupyter.

To make this the default IPython or IPython${python_major} (i.e., the version run by\
the 'ipython' or 'ipython${python_major}' commands), run one or both of:

    sudo port select --set ipython py${python.version}-ipython
    sudo port select --set ipython${python_major} py${python.version}-ipython
    "

    livecheck.type      none
}