# -*- 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
# $Id: Portfile 106911 2013-06-11 14:40:14Z jmr@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-google-api
set realname        google-api-python-client
version             1.1

# There are no py3x-uritemplate subports (#38502).
python.versions     25 26 27

categories-append   www devel
maintainers         nomaintainer
license             Apache-2 MIT
description         client library for accessing the Plus, Moderator, and many \
                    other Google APIs
long_description    ${description}

platforms           darwin
supported_archs     noarch

homepage            http://pypi.python.org/pypi/${realname}
master_sites        googlecode:${realname}
distname            ${realname}-${version}
distfiles           ${distname}${extract.suffix} \
                    ${realname}-samples-${version}${extract.suffix}

if {$subport != $name} {
    depends_build           port:py${python.version}-setuptools
    depends_lib-append      port:py${python.version}-httplib2 \
                            port:py${python.version}-gflags \
                            port:py${python.version}-uritemplate \
                            port:py${python.version}-oauth2client
    
    post-destroot {
        delete ${destroot}${python.pkgd}/uritemplate
        delete ${destroot}${python.pkgd}/oauth2client
        
        set egg-info ${destroot}${python.pkgd}/google_api_python_client-${version}-py${python.branch}.egg-info
        foreach d [glob -dir ${egg-info} *] {
            file attributes ${d} -permissions 0644
        }

        xinstall -d -m 555 ${destroot}${prefix}/share/examples
        copy ${workpath}/samples ${destroot}${prefix}/share/examples/${subport}
    }
}

subport py25-google-api {
    depends_lib-append      port:py25-simplejson
}

checksums           google-api-python-client-1.1.tar.gz \
                    rmd160  13288c8b9e43eba86ed3485dbf882b764dec98b3 \
                    sha256  bc88cae1c40446f22d58923fc5a8dbac77da29d6efbe4ae2276cc2f30f724617 \
                    google-api-python-client-samples-1.1.tar.gz \
                    rmd160  226f9e48827dbefd8aa20172fc6c6839e66153d4 \
                    sha256  e0465027ca73ec0102ee3043fa7635bd515f5ca4d10a6707acc9a4c98a89b977

livecheck.type      regex
livecheck.url       http://pypi.python.org/pypi/${realname}
livecheck.regex     "${realname} (\[1-9\]+\.\[0-9\]+)"
