PortSystem          1.0

name                gsutil
version             20110908
set year            [string range ${version} 0 3]
set month           [string range ${version} 4 5]
set day             [string range ${version} 6 7]
categories          net
platforms           darwin
license             Apache-2
maintainers         nomaintainer
supported_archs     noarch

description         command line utility for interacting with cloud storage services
long_description \
  gsutil allows you to store, share and manage data hosted at cloud-based \
  storage providers. It supports a URI syntax for naming data, as well as \
  URI wildcards. At present gsutil works with Google Storage for Developers \
  and Amazon's Simple Storage Service (S3). gsutil is implemented in Python, \
  atop the popular boto open source library.

homepage            http://code.google.com/p/${name}/
master_sites        googlecode
distname            ${name}_${month}-${day}-${year}
worksrcdir          ${name}

depends_lib         port:py27-gslib

checksums           md5     65577aea58479c4eea190dd93b72c42b \
                    sha1    58bb5e5b4443576c548bb795f5aa30c3d12ea8c5 \
                    rmd160  b08b6f303d43eb23bc3be165cdfc68c30ae8d82e

patchfiles          gsutil.patch

build {}
destroot {
    move ${worksrcpath}/gsutil ${destroot}${prefix}/bin/gsutil

    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 644 -W ${worksrcpath} README ${docdir}
    move ${worksrcpath}/cloudauth ${worksrcpath}/cloudreader ${docdir}
}

variant python27 description {Use Python 2.7} {
    depends_lib         port:py27-gslib port:python27
    configure {
        set python.bin  ${frameworks_dir}/Python.framework/Versions/2.7/bin/python2.7
        reinplace "s|#!/usr/bin/env python|#!${python.bin}|" ${worksrcpath}/gsutil
    }
}
default_variants    +python27