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

github.setup        harelba q 3.1.7 v
github.tarball_from archive
name                q-textasdata
revision            0

homepage            https://harelba.github.io/q

description         ${name} - Run SQL directly on CSV or TSV files
long_description    ${name} is a command line tool that allows direct \
                    execution of SQL-like queries on CSVs/TSVs (and any other \
                    tabular text files). ${name} treats ordinary files as \
                    database tables, and supports all SQL constructs, such as \
                    WHERE, GROUP BY, JOINs, etc. It supports automatic column \
                    name and type detection, and q provides full support for \
                    multiple character encodings.

categories          textproc python
supported_archs     noarch
platforms           {darwin any}
license             GPL-3+
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  33b1a23bf27002ad801015f3156fe831b299478e \
                    sha256  3ffe7b4091218bb0b8c5a6def82395bdbe12d1c5c04aae79db07eec420d3869c \
                    size    278157

python.versions     314

depends_lib-append  port:py${python.version}-six

# fix packaging issues
post-extract {
    file mkdir ${worksrcpath}/src/q
    file copy {*}[glob ${worksrcpath}/bin/*] ${worksrcpath}/src/q
    file rename ${worksrcpath}/test ${worksrcpath}/tests
}

patchfiles          patch-fix-broken-packaging.diff
patch.pre_args-replace  -p0 -p1

post-patch {
    reinplace "s|3\.1\.6|${version}|g" ${worksrcpath}/setup.py ${worksrcpath}/src/q/q.py
}

post-destroot {
    ln -s q ${destroot}${prefix}/bin/${name}
}
