# -*- 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           github 1.0

github.setup        urwid urwid 2.6.16
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
name                py-${name}
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  2f64dbd917c28345607c6d77fcf1597978492de4 \
                    sha256  4956910067e501ae6d6779bd865d0300d5fa71eb35ca2891636eeb1918cd1fb0 \
                    size    810668

python.versions     27 38 39 310 311 312 313

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

    if {${python.version} <= 37} {
        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
    }
}
