# -*- 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 118309 2014-03-29 21:51:39Z stromnov@macports.org $

PortSystem          1.0
PortGroup           python 1.0

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

python.versions     24 25 26 27 31 32 33 34

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        https://pypi.python.org/packages/source/S/SQLAlchemy/

distname            SQLAlchemy-${version}

checksums           rmd160  d2ba2699f56b01a694e3fb449fc4f9cb8d5d0371 \
                    sha256  bc87674f5ac9962e0efe96f060ba22a07e2c61fbebf531efc383b82db5b291ec

# Latest supported version for python 2.4
subport py24-sqlalchemy {
    version             0.7.10
    revision            0
    epoch               1
    distname            SQLAlchemy-${version}
    checksums           rmd160  561ae29cafb1e0a76fc2d86210d756ab8a5e401b \
                        sha256  77aa39d65c9d043eba6ba329b359ff867424fd6c403b7c0cb112b65e507e1d66
}

# Latest supported version for python 2.5
subport py25-sqlalchemy {
    version             0.8.4
    revision            0
    distname            SQLAlchemy-${version}
    checksums           rmd160  052f11f1dd850461e8f77e32e9a67950a330a62b \
                        sha256  92646ef7567d85d42ad7abf4ccc4327d664d32d4e9e4fd8a241f865c639a98c0
}

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

    post-destroot {
        # Install example files not installed by the Makefile
        if {${subport} eq "py24-sqlalchemy" || ${subport} eq "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]
            }
        } else {
            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.type          regex
    livecheck.url           ${master_sites}
    livecheck.regex         {SQLAlchemy-(\d+(?:\.\d+)*)\.[tz]}
}
