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

github.setup        facebook pyre2 1.0.7 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            5
name                py-re2

categories-append   devel
license             BSD
maintainers         nomaintainer

description         Python wrapper of Google's RE2 library.
long_description    pyre2 is a Python extension that wraps Google's RE2 regular \
                    expression library. It implements many of the features of \
                    Python's built-in re module with compatible interfaces.

checksums           rmd160  8d370f3855fd0daacb35880e26db284acc64fc77 \
                    sha256  236ed6f80d9db39888d5cc2abde5ca62d89e13a0f7ebdee24e371b4ddb29cc12 \
                    size    11685

python.versions     39 310 311 312 313

if {${name} ne ${subport}} {
    depends_lib-append \
                    port:re2

    compiler.cxx_standard   2017
    # hack to use proper compiler and stdlib
    configure.cc        ${configure.cxx}
    configure.cflags    {*}${configure.cxxflags}
    python.add_cflags   yes

    post-patch {
        reinplace {s|-std=c\+\+11|-std=c++17|g} ${worksrcpath}/setup.py
    }

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} README.rst LICENSE \
            CONTRIBUTING.md CODE_OF_CONDUCT.md ${destroot}${docdir}
    }

    test.run        yes
    python.test_framework
    test.cmd        ${python.bin} setup.py
}
