# $Id: Portfile 145529 2016-02-08 22:12:39Z devans@macports.org $

PortSystem      1.0
PortGroup       python 1.0
PortGroup       github 1.0

name            py-protobuf
version         2.6.1
revision        2
categories-append   devel
maintainers     blair
license         BSD
description     Encode data in an efficient yet extensible format.

long_description \
                Google Protocol Buffers are a flexible, efficient, \
                automated mechanism for serializing structured data -- \
                think XML, but smaller, faster, and simpler.  You \
                define how you want your data to be structured once, \
                then you can use special generated source code to \
                easily write and read your structured data to and from \
                a variety of data streams and using a variety of \
                languages.  You can even update your data structure \
                without breaking deployed programs that are compiled \
                against the "old" format.  You specify how you want \
                the information you're serializing to be structured by \
                defining protocol buffer message types in .proto \
                files.  Each protocol buffer message is a small \
                logical record of information, containing a series of \
                name-value pairs.

github.setup    google protobuf ${version} v
github.tarball_from releases
homepage        https://github.com/google/protobuf
master_sites    https://github.com/google/protobuf/releases/download/v${version}
distfiles       protobuf-${version}.tar.bz2
worksrcdir      protobuf-${version}

use_bzip2       yes
checksums       sha1    6421ee86d8fb4e39f21f56991daa892a3e8d314b \
                sha256  ee445612d544d885ae240ffbcbf9267faa9f593b7b101f21d58beceb92661910

platforms       darwin

python.versions 26 27

if {${name} ne ${subport}} {
    depends_build   port:py${python.version}-google-apputils
    depends_lib     port:protobuf-cpp \
                    port:py${python.version}-setuptools

    worksrcdir      ${worksrcdir}/python

    destroot.cmd-append    --cpp_implementation

    test.run        yes
    test.cmd        "${python.bin} setup.py"
    test.target     test --cpp_implementation
}
