# $Id: Portfile 91979 2012-04-14 11:33:24Z jmr@macports.org $

PortSystem 1.0
PortGroup python 1.0

name                py-oursql
version             0.9.2
categories          python devel databases
maintainers         gmail.com:habnabit
description         Python driver for MySQL
long_description    oursql is a set of MySQL bindings for python with a focus \
                    on wrapping the MYSQL_STMT API to provide real \
                    parameterization and real server-side cursors.
platforms           darwin
homepage            https://launchpad.net/oursql
master_sites        http://launchpad.net/oursql/trunk/${version}/+download/
distname            oursql-${version}
use_bzip2           yes
checksums           sha1 d3d82bc5f6bf646f37853020171fed48e9920d9e \
                    rmd160 0f38d57b34ce5194c8ad5a9717e5cf3fe2dcd7af

python.versions     26 27
python.default_version 27

variant mysql4 conflicts mysql5 description {Build with MySQL 4} {
    if {$subport != $name} {
        depends_lib-append  port:mysql4
        build.env           MYSQL_CONFIG=mysql_config4
    }
}

variant mysql5 conflicts mysql4 description {Build with MySQL 5} {
    if {$subport != $name} {
        depends_lib-append  path:bin/mysql_config5:mysql5
        build.env           MYSQL_CONFIG=mysql_config5
    }
}

if {![variant_isset mysql4]} {
    default_variants +mysql5
}

pre-fetch {
    if {![variant_isset mysql4] && ![variant_isset mysql5]} {
        return -code error "you must select either mysql4 or mysql5"
    }
}
