# -*- 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 67780 2010-05-18 10:48:30Z snc@macports.org $

PortSystem          1.0
PortGroup           python27 1.0

name                py27-psycopg2
version             2.2.1
categories-append   databases
license             GPLv2+
maintainers         snc openmaintainer
description         A python DBAPI-2.0 ompliant database adapter for postgresql
long_description    Psycopg2 is a postgresql database adapter for python. \
                    It's fully compliant to pythons DBAPI-2.0. psycopg is \
                    designed for heavily multi-threaded applications \
                    featuring connection pooling.
homepage            http://www.initd.org/software/initd/psycopg/

platforms           darwin freebsd
depends_lib-append  port:openssl

distname            psycopg2-${version}
master_sites        http://initd.org/pub/software/psycopg/

checksums           md5     70b50773aefe5fb371ff4a018382012f \
                    sha1    1ab82e2cfc2be1464ef7dc1cf8c109cb0da364b2 \
                    rmd160  55ebf6648a32681af46f4b04c233c10b59c428e5

patchfiles          patch-setup.cfg.diff


if {![variant_isset postgresql82] && ![variant_isset postgresql83] && ![variant_isset postgresql84]} {
    default_variants    +postgresql84
}

variant postgresql82 conflicts postgresql83 postgresql84 description "Build using postgresql v8.2" {
    depends_lib-append  port:postgresql82

    post-patch {
        reinplace \
            s|@PG_CONFIG@|${prefix}/lib/postgresql82/bin/pg_config|g \
            ${worksrcpath}/setup.cfg
    }
}

variant postgresql83 conflicts postgresql82 postgresql84 description "Build using postgresql v8.3" {
    depends_lib-append port:postgresql83

    post-patch {
        reinplace \
            s|@PG_CONFIG@|${prefix}/lib/postgresql83/bin/pg_config|g \
            ${worksrcpath}/setup.cfg
    }
}

variant postgresql84 conflicts postgresql82 postgresql83 description "Build using postgresql v8.4" {
    depends_lib-append port:postgresql84

    post-patch {
        reinplace \
            s|@PG_CONFIG@|${prefix}/lib/postgresql84/bin/pg_config|g \
            ${worksrcpath}/setup.cfg
    }
}

livecheck.url       ${master_sites}
livecheck.regex     psycopg2-(\\d+\\.\\d+(\\.\\d+)?)\\.tar\\.gz
