# -*- 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-automat
version             25.4.16
revision            0

categories-append   devel
platforms           {darwin any}
supported_archs     noarch
license             MIT
maintainers         {mcalhoun @MarcusCalhoun-Lopez} openmaintainer

description         A library for concise, idiomatic Python expression of finite-state automata
long_description    Automat is a library for concise, idiomatic Python expression of finite-state \
                    automata (particularly deterministic finite-state transducers).

homepage            https://github.com/glyph/automat

checksums           rmd160  480f4c3d16f36b18d9eb06ed1c11fa1c3b32ad0a \
                    sha256  0017591a5477066e90d26b0e696ddc143baafd87b588cfac8100bc6be9634de0 \
                    size    129977

python.versions     27 310 311 312 313 314
python.pep517_backend \
                    hatch

if {${name} ne ${subport}} {
    depends_build-append \
                    port:py${python.version}-setuptools_scm\
                    port:py${python.version}-wheel
    if {${python.version} == 27} {
        depends_build-append \
                    port:py${python.version}-m2r

        python.rootname \
                    Automat
        version     20.2.0
        checksums   rmd160  389126c3183fdd8ad34333d86490e2ba448ced94 \
                    sha256  7979803c74610e11ef0c0d68a2942b152df52da55336e0c9d58daf1831cbdf33 \
                    size    61679
    } else {
        depends_build-append \
                    port:py${python.version}-hatch-vcs
    }

    # uses from "pkg_resources import load_entry_point"
    depends_lib-append \
                    port:py${python.version}-setuptools

    depends_run-append \
                    port:py${python.version}-attrs \
                    port:py${python.version}-six

    # see https://pypi.python.org/pypi/Automat/
    # see https://trac.macports.org/ticket/54627
    # see https://trac.macports.org/ticket/56955
    #depends_run-append \
        #port:py${python.version}-twisted   \
        #port:py${python.version}-graphviz
    if {
        [catch {set installed [lindex [registry_active py${python.version}-twisted] 0]}] ||
        [catch {set installed [lindex [registry_active py${python.version}-graphviz] 0]}]
    } {
        notes "
${subport} requires py${python.version}-twisted and py${python.version}-graphviz to enable the visualize feature.
However, py${python.version}-twisted depends on ${subport} to run correctly.
Please install py${python.version}-twisted and py${python.version}-graphviz manually for full functionality.
"
    }

    test.run        yes
    if {${python.version} != 27} {
        depends_test-append \
                    port:py${python.version}-graphviz \
                    port:py${python.version}-pytest-benchmark \
                    port:py${python.version}-twisted
        test.env-append \
                    PYTHONPATH=${worksrcpath}/src
    }
}
