# -*- 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
# $Id: Portfile 118982 2014-04-14 17:49:09Z snc@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-parsing
version             1.5.7
# Python26 and newer uses version 2.x
if {${name} ne ${subport}} {
    if {${python.version} > 25} {
        version             2.0.2
    }
}
categories-append   lang
platforms           darwin
maintainers         snc openmaintainer
license             MIT

description         alternative approach to creating parsers in python

long_description    The parsing module is an alternative approach to creating \
                    and executing simple grammars, vs. the traditional \
                    lex/yacc approach, or the use of regular expressions. The \
                    parsing module provides a library of classes that client \
                    code uses to construct the grammar directly in Python code.

homepage            http://pyparsing.wikispaces.com/
master_sites        sourceforge:project/pyparsing/pyparsing/pyparsing-${version}
distname            pyparsing-${version}

checksums           rmd160  1a298790ce3569e74a1223de495cd5a5fd87e7b4 \
                    sha256  2b3a013582cbff858e71ff23129e01acc5e99f511578d106ffb1e74bde15e893

python.versions     25 26 27 31 32 33 34

if {${name} ne ${subport}} {
    if {${python.version} > 25} {
        checksums           rmd160  e9e90763bba4f85c6f967b2495165cf0a83d76a1 \
                            sha256  17e43d6b17588ed5968735575b3983a952133ec4082596d214d7090b56d48a06

    } else {
        post-destroot {
            set docdir ${destroot}${prefix}/share/doc/${subport}
            xinstall -d ${docdir}
            xinstall -m 644 -W ${worksrcpath} CHANGES HowToUsePyparsing.html \
                LICENSE README ${docdir}
            eval xinstall -m 644 [glob ${worksrcpath}/docs/*] ${docdir}
            eval xinstall -m 644 [glob ${worksrcpath}/examples/*] ${docdir}/examples/
        }
    }

    if {${python.version} == 33} {
        livecheck.regex pyparsing-(2(\\.\\d+)+)
    } elseif {${python.version} == 25} {
        livecheck.regex pyparsing-(1(\\.\\d+)+)
    } else {
        livecheck.type  none
    }
} else {
    livecheck.type  none
}
