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

python.versions     27 35 36 37 38 39

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

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

homepage            https://ipython.org/

checksums           rmd160  2cb28cc75c9f52eb6ca853a4d40d70a6cd4de89d \
                    sha256  9c900332d4c5a6de534b4befeeb7de44ad0cc42e8327fa41b7685abde58cec74 \
                    size    5143229

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 35} {
        version             7.9.0
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  f7814918d76d323a725f8dc522a2a64830421f5e \
                            sha256  dfd303b270b7b5232b3d08bd30ec6fd685d8a58cabd54055e3d69d8f029f7280 \
                            size    5124623
    } elseif {${python.version} eq 36} {
        version             7.16.1
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  a1c8d7b5d6cf0c82b9e59cbaf4062bbb58486942 \
                            sha256  9f4fcb31d3b2c533333893b9172264e4821c1ac91839500f31bd43f2c59b3ccf \
                            size    5136303
    }

    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 "
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
}
