# $Id: Portfile 49012 2009-04-01 23:00:35Z wsiegrist@apple.com $

PortSystem 1.0
PortGroup python25 1.0

name			py25-psycopg2
version			2.0.9
categories		python databases
maintainers		nomaintainer
platforms		darwin freebsd
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/
master_sites		http://initd.org/pub/software/psycopg/ \
			http://initd.org/pub/software/psycopg/PSYCOPG-2-0/
distname		psycopg2-${version}
checksums           md5     885e5bd372afafd14cfd914b000462e7 \
                    sha1    d6aca4b96b69207a795934623de60e9c9ce32378 \
                    rmd160  3194fbae1c69a3734e4db91e21db4b688de1d630

depends_lib-append	port:openssl

patchfiles		patch-setup.cfg


variant postgresql82 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 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
	}
}

pre-patch {
    if {![variant_isset postgresql83] && ![variant_isset postgresql82]} {
        return -code error "You have to choose either +postgresql82 or +postgresql83"
    }
}

