# $Id: Portfile,v 1.8 2006/04/30 13:59:24 mww Exp $

PortSystem 1.0
PortGroup python24 1.0

name			py-bsddb
version			2.4.3
categories		python databases
platforms		darwin
maintainers		mww@opendarwin.org
description		Python bindings to the db4 and db3 library
long_description	${description}

homepage		http://www.python.org/doc/current/lib/module-dbm.html
master_sites	http://www.python.org/ftp/python/${version}/
distname		Python-${version}
dist_subdir		python24
checksums		md5 141c683447d5e76be1d2bd4829574f02
use_bzip2		yes

worksrcdir		${worksrcdir}/Modules

extract.post_args	"| tar -xf - ${distname}/Modules/bsddbmodule.c \
				${distname}/Modules/_bsddb.c"
post-extract {
	file copy	${filespath}/setup.py ${worksrcpath}
}

set db_version	4
depends_lib-append	lib:libdb-4:db4

variant db3	{
	set db_version	3
	depends_lib-delete	lib:libdb-4:db4
	depends_lib-append	lib:libdb-3:db3
}

post-patch	{
	cd ${worksrcpath}
	reinplace "s|__VERSION__|${version}|g" setup.py
	reinplace "s|__PREFIX__|${prefix}|g" setup.py
	reinplace "s|<db.h>|<db${db_version}/db.h>|g" _bsddb.c
}

