# $Id: Portfile 45163 2009-01-09 14:39:48Z jmr@macports.org $

PortSystem			1.0

name				python23
version				2.3.7
revision			1
categories			lang
maintainers			nomaintainer
description			An interpreted, object-oriented programming language
long_description	${description}

platforms			darwin freebsd sunos

homepage			http://www.python.org/
master_sites		${homepage}ftp/python/${version}/ \
					ftp://ftp.python.org/pub/python/${version}/
distname			Python-${version}
use_bzip2			yes
checksums			md5 fa73476c5214c57d0751fae527f991e1 \
					sha1 1e04709f527d5dd0ce9adde1cfca6aa2bb0ddce6

# Should be depends_extract, but that isn't implemented
depends_build		bin:gnutar:gnutar

extract.post_args	| gnutar -xf -

patchfiles			patch-Makefile.pre.in patch-configure.in patch-setup.py

use_autoconf		yes

configure.args		--enable-shared --mandir=${prefix}/share/man --disable-tk

post-patch {
	reinplace "s|@@VERSION@@|${version}|g" ${worksrcpath}/Makefile.pre.in
}

post-destroot {
	file delete ${destroot}${prefix}/bin/python
	file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python2.3.1
	file rename ${destroot}${prefix}/bin/pydoc ${destroot}${prefix}/bin/pydoc2.3
	file rename ${destroot}${prefix}/bin/idle ${destroot}${prefix}/bin/idle2.3
	reinplace "s|${prefix}/bin/python|${prefix}/bin/python2.3|g" \
		${destroot}${prefix}/bin/pydoc2.3 ${destroot}${prefix}/bin/idle2.3

	# install select file for python_select
	xinstall -m 755 -d ${destroot}${prefix}/etc/select/python
	xinstall -m 644 ${filespath}/python23 ${destroot}${prefix}/etc/select/python/
}

variant nothreads {
	configure.args-append	--without-threads
}

variant puredarwin {
	configure.args-append	--disable-toolbox-glue
}

platform darwin i386 {
	configure.args-append	--disable-toolbox-glue
}

platform darwin 8 {
	patchfiles-append	patch-darwin8-pyconfig.h.in
}
platform darwin 9 {
        patchfiles-append       patch-darwin8-pyconfig.h.in \
                                patch-Include_pyport.h.diff
}

variant pydebug {
	configure.args-append	--with-pydebug
}

variant readline {
	depends_lib-append		port:readline
	configure.args-append	--with-readline
}

platform darwin {
	if {![variant_isset puredarwin] && ![variant_isset darwin_i386]} {
		configure.env-append	LIBS="-framework CoreServices \
								-framework Foundation"
	}
}

variant tk {
	configure.args-delete	--disable-tk
	depends_lib-append		port:tk
}
