# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           python 1.0

name                py-ply
version             3.11
revision            0

categories-append   lang devel
platforms           {darwin any}
license             BSD
supported_archs     noarch
maintainers         {reneeotten @reneeotten} openmaintainer

description         lex and yacc implementation for Python
long_description    {*}${description}

homepage            https://www.dabeaz.com/ply/

checksums           rmd160  d0039bbbf095aeb7ed82fc2fab4b4699e8406d50 \
                    sha256  00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3 \
                    size    159130

python.versions     27 310 311 312 313 314

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

    post-patch {
        reinplace "s|assert_|assertTrue|g" \
            ${worksrcpath}/test/testlex.py ${worksrcpath}/test/testyacc.py
    }

    python.test_framework
    test.run        yes
    test.dir        ${build.dir}/test
    test.cmd        ${python.bin} testlex.py && ${python.bin} testyacc.py
    test.target
    test.env        PYTHONPATH=${worksrcpath}/build/lib

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}/html

        xinstall -m 0644 -W $worksrcpath ANNOUNCE CHANGES \
            TODO README.md ${destroot}${docdir}

        xinstall -m 0644 $worksrcpath/doc/ply.html \
            ${destroot}${docdir}/html
    }
}
