# -*- 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-tpg
version             3.2.2
revision            0
license             LGPL-2.1+
platforms           darwin freebsd
supported_archs     noarch
maintainers         nomaintainer
description         lexical and syntactic parser generator for Python
long_description    Toy Parser Generator is a lexical and syntactic parser \
                    generator for Python. With a very clear and simple \
                    syntax, you can write an attributed grammar that is \
                    translated into a recursive descendant parser. TPG \
                    generated code is very closed to the original grammar. \
                    This means that the parser works like the grammar. A \
                    grammar rule can be seen as a method of the parser \
                    class, symbols as method calls, attributes as method \
                    parameters and semantic values as return values. You \
                    can also add Python code directly into grammar rules \
                    and build abstract syntax trees while parsing.

homepage            https://cdsoft.fr/tpg/
master_sites        ${homepage}
distname            TPG-${version}
checksums           rmd160  e254a462fb390af038b08b251e4ca4d0142b347f \
                    sha256  52e61232b09df90afa7d26555526464ce4d2b194d9fc505298c75036b1442923 \
                    size    379868

python.versions     27

if {${name} ne ${subport}} {
    # fix permissions
    post-extract {
        fs-traverse item ${worksrcpath} {
            if {[file isdirectory ${item}]} {
                file attributes ${item} -permissions a+rx
            } elseif {[file isfile ${item}]} {
                file attributes ${item} -permissions a+r
            }
        }
    }

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} ChangeLog License.txt \
            README THANKS ${destroot}${docdir}
    }

    livecheck.type  none
} else {
    livecheck.regex TPG-(\[0-9.\]+)${extract.suffix}
}
