# -*- 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 107764 2013-07-05 10:15:42Z stromnov@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-sqlalchemy
version             0.8.2
revision            0
categories-append   databases
platforms           darwin
license             MIT

maintainers         landonf akitada openmaintainer

description         Python SQL ORM

long_description    SQLAlchemy is the Python SQL toolkit and Object \
                    Relational Mapper that gives application developers \
                    the full power and flexibility of SQL.

homepage            http://www.sqlalchemy.org/
master_sites        sourceforge:sqlalchemy

distname            SQLAlchemy-${version}

checksums           rmd160  ed201164623f35bfa2a45c840273b06be9eeec87 \
                    sha256  fb0814b1198331164d1b12c37c0cced3c84350a4279f9ef43c613fb2d2fb9d86

python.versions     24 25 26 27 31 32 33

subport py24-sqlalchemy {
    version             0.7.10
    revision            0
    epoch               1
    master_sites        https://pypi.python.org/packages/source/S/SQLAlchemy/
    distname            SQLAlchemy-${version}
    checksums           rmd160  561ae29cafb1e0a76fc2d86210d756ab8a5e401b \
                        sha256  77aa39d65c9d043eba6ba329b359ff867424fd6c403b7c0cb112b65e507e1d66
    livecheck.type      none
}

if {$subport != $name} {
    depends_build-append    port:py${python.version}-setuptools

    post-destroot {
        # Install example files not installed by the Makefile
        if {$subport == "py24-sqlalchemy" || $subport == "py25-sqlalchemy"} {
            xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport}/examples
            foreach f [glob -directory ${worksrcpath}/doc *] {
                copy $f ${destroot}${prefix}/share/doc/${subport}/[file tail $f]
            }
            foreach f [glob -directory ${worksrcpath}/examples *] {
                copy $f ${destroot}${prefix}/share/doc/${subport}/examples/[file tail $f]
            }
        } elseif {$subport == "py26-sqlalchemy" || $subport == "py27-sqlalchemy" || $subport == "py31-sqlalchemy" || $subport == "py32-sqlalchemy" || $subport == "py33-sqlalchemy" } {
            xinstall -m 755 -d ${destroot}${python.prefix}/share/doc/sqlalchemy/examples
            foreach f [glob -directory ${worksrcpath}/doc *] {
                copy $f ${destroot}${python.prefix}/share/doc/sqlalchemy/[file tail $f]
            }
            foreach f [glob -directory ${worksrcpath}/examples *] {
                copy $f ${destroot}${python.prefix}/share/doc/sqlalchemy/examples/[file tail $f]
            }
        }
    }

    livecheck.type          none
} else {
    livecheck.regex         {<a href="/download\.html"><b>(.+?)</b></a>}
    livecheck.type          regex
    livecheck.url           ${homepage}
}
