# -*- 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
python.rootname     Automat
version             0.8.0
revision            0

categories-append   devel
platforms           darwin
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
master_sites        pypi:[string index ${python.rootname} 0]/${python.rootname}
distname            ${python.rootname}-${version}

checksums           rmd160  47ebcfc9c49f75aaa6dadc2eeb97d942e1dac0bc \
                    sha256  269a09dfb063a3b078983f4976d83f0a0d3e6e7aaf8e27d8df1095e09dc4a484 \
                    size    59687

python.versions     27 35 36 37 38

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

    # 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.
"
    }

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

    test.run        yes
    test.cmd        py.test-${python.branch}
    test.target     automat/_test
    test.env        PYTHONPATH=${worksrcpath}/build/lib

    livecheck.type  none
}