# -*- 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-urwid
version             4.0.2
revision            0

license             LGPL-2.1+
maintainers         nomaintainer

description         curses-based UI/widget library for Python
long_description    Urwid is a curses-based UI/widget library for Python. It features fluid \
                    interface resizing, multiple text layout options, simple markup for \
                    attributes, powerful scrolling list boxes and flexible edit boxes.

homepage            https://urwid.org/

checksums           rmd160  2c918bd89d4fbecb7d08f7227315a0d32a0d8aee \
                    sha256  6962bd04ab98002326b67a431c59b2fb35e8b5abe2e095feda3ee7d8ea8f1228 \
                    size    861918

python.versions     27 310 311 312 313 314

if {${name} ne ${subport}} {
    test.run        yes

    if {${python.version} == 27} {
        PortGroup       github 1.0

        github.setup    urwid urwid 2.1.2 release-
        # Change github.tarball_from to 'releases' or 'archive' next update
        github.tarball_from tarball
        revision        0
        checksums       rmd160  4d8666717bee9d9fdabcc1c7b551ff583a28e307 \
                        sha256  c21112c3c524110dd5cad78f7987a9fe0c57a66b756e1e0385e572b946ec86d1 \
                        size    607749
        depends_build-append \
                        port:py${python.version}-setuptools
    } else {
        # compiled C extension has been removed since v2.6.0
        platforms       {darwin any}
        supported_archs noarch

        depends_build-append \
                        port:py${python.version}-setuptools_scm

        build.env-append \
                        SETUPTOOLS_SCM_PRETEND_VERSION=${version}

        depends_lib-append \
                        port:py${python.version}-typing_extensions \
                        port:py${python.version}-wcwidth

    }

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}/examples
        xinstall -m 0644 -W ${worksrcpath}/examples \
            browse.py calc.py edit.py fib.py tour.py \
            ${destroot}${docdir}/examples
    }
}
