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

set _name           PrettyTable
set _n              [string index ${_name} 0]

# Attention: py-ipython-sql requests prettytable<1.
# Please do not bump version without considering this dependency.
name                py-prettytable
version             0.7.2
platforms           {darwin any}
supported_archs     noarch
license             BSD
maintainers         {petr @petrrr} openmaintainer

description         A simple Python library for easily displaying tabular \
                    data in a visually appealing ASCII table format.
long_description    PrettyTable is a simple Python library designed to make \
                    it quick and easy to represent tabular data in visually \
                    appealing ASCII tables. It was inspired by the ASCII \
                    tables used in the PostgreSQL shell psql. PrettyTable \
                    allows for selection of which columns are to be printed, \
                    independent alignment of columns (left or right justified \
                    or centred) and printing of "sub-tables" by specifying a \
                    row range.
categories-append   textproc

homepage            https://pypi.python.org/pypi/${_name}
master_sites        pypi:${_n}/${_name}/
distname            prettytable-${version}

checksums           rmd160  af187cbcf1139866bc67b1bc8cb5c3187726b41f \
                    sha256  2d5460dc9db74a32bcc8f9f67de68b2c4f4d2f01fa3bd518764c69156d9cacd9 \
                    size    24784

python.versions     37 38 39 310 311

if {$subport ne $name} {
    depends_build       port:py${python.version}-setuptools

    # fix wrong file permissions of the distfile
    post-extract {
        fs-traverse f ${worksrcpath} {
            file attributes ${f} -permissions a+r
        }
    }

    # add documentation
    post-destroot {
        set dest_doc ${destroot}${prefix}/share/doc/${subport}
        xinstall -d  ${dest_doc}
        xinstall -m 755 -W ${worksrcpath} \
            README \
            COPYING \
            CHANGELOG \
                ${dest_doc}
    }
} else {
    livecheck.type  regex
    livecheck.url   https://pypi.python.org/pypi/${_name}/json
    livecheck.regex "\"prettytable-(\[.\\d\]+)\\${extract.suffix}\""
}
