# -*- 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 114324 2013-12-05 08:44:51Z ryandesign@macports.org $

PortSystem          1.0
PortGroup           python 1.0

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

# 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 {${name} ne ${subport}} {
    depends_build           port:py${python.version}-setuptools
    depends_lib-append      port:py${python.version}-httplib2 \
                            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           ${realname}-${version}${extract.suffix} \
                    rmd160  785756e2b3a0c76f60f590574bb71834690dd921 \
                    sha256  3cb3f39c4a634950aee34f52e2a160b9a064b15210f7196ba364f670780aa675 \
                    ${realname}-samples-${version}${extract.suffix} \
                    rmd160  f7f86fe566438e8d1e972153a40ae4f79f024003 \
                    sha256  4c7a469caebe4926967b00ac3e14eadd28fbb3b10ec2672dd993028fd2add6bd

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