# -*- 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-astroid
version             2.5.2
revision            0

categories-append   devel
platforms           darwin
license             LGPL-2.1+
supported_archs     noarch

python.versions     27 35 36 37 38 39

maintainers         {stromnov @stromnov} openmaintainer

description         Rebuild a new abstract syntax tree from Python's ast.

long_description    The aim of this module is to provide a common \
                    base representation of python source code for \
                    projects such as pychecker, pyreverse, pylint... \
                    Well, actually the development of this library is \
                    essentially governed by pylint's needs.

homepage            https://github.com/pycqa/astroid

checksums           rmd160  9b742e8614c9abf652182318880b5f06106add33 \
                    sha256  6b0ed1af831570e500e2437625979eaa3b36011f66ddfc4ce930128610258ca9 \
                    size    312789

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

    depends_lib-append  port:py${python.version}-lazy_object_proxy \
                        port:py${python.version}-wrapt

    if {${python.version} < 38} {
        depends_lib-append  port:py${python.version}-typed-ast
    }

    if {${python.version} eq 27} {
        version             1.6.5
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  bba1d1e3582e557ecbe6a56ca83adef5b1d80506 \
                            sha256  fc9b582dba0366e63540982c3944a9230cbc6f303641c51483fa547dcc22393a \
                            size    255688

        depends_lib-append  port:py${python.version}-six \
                            port:py${python.version}-enum34 \
                            port:py${python.version}-singledispatch \
                            port:py${python.version}-backports-functools_lru_cache

        depends_build-delete \
                            port:py${python.version}-pytest-runner

        depends_lib-delete  port:py${python.version}-typed-ast
    } elseif {${python.version} eq 35} {
        version             2.4.2
        revision            1
        distname            ${python.rootname}-${version}
        checksums           rmd160  0ea44ae5243e5e8abad79672d53b71c1521613f7 \
                            sha256  2f4078c2a41bf377eea06d71c9d2ba4eb8f6b1af2135bec27bbbb7d8f12bb703 \
                            size    310972

        # fix for py-lazy_object_proxy version 1.5
        post-patch {
            reinplace {s|lazy_object_proxy==1\.4\.\*|lazy_object_proxy>=1.4.*|g} \
                ${worksrcpath}/astroid/__pkginfo__.py
        }

        depends_lib-append  port:py${python.version}-six
    }

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

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

    post-destroot {
        xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport}
        xinstall -m 644 -W ${worksrcpath} ChangeLog README.rst \
            ${destroot}${prefix}/share/doc/${subport}
    }

    livecheck.type      none
}
