# $Id: Portfile 39018 2008-08-06 07:46:29Z jmr@macports.org $

PortSystem 1.0

name		python21
version		2.1.3
categories	lang
maintainers	nomaintainer
homepage	http://www.python.org/
description	An interpreted, object-oriented programming language
long_description	Python is an interpreted, interactive, object-oriented programming \
			language that combines remarkable power with very clear syntax. \
			This is the older 2.1 series of Python which is needed when installing \
			the Zope and/or Plone ports.
platforms	darwin
distname	Python-${version}
extract.suffix	.tgz
master_sites	${homepage}ftp/python/${version}/ \
				ftp://ftp.python.jp/ftp.python.org/python/${version}/ \
				ftp://ftp.python.org/pub/python/${version}/
checksums	md5 a8b04cdc822a6fc833ed9b99c7fba589
depends_lib	lib:expat.0:expat
extract.only	Python-${version}${extract.suffix}

patchfiles	patch-configure.diff

post-patch	{ reinplace "s|MANDIR=.*/|&share/|" ${worksrcpath}/Makefile.pre.in
		  reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/setup.py
		  reinplace "s|'Tools/scripts/pydoc'||" ${worksrcpath}/setup.py
		  reinplace "s|osname = string.replace(.*)|&; machine = string.replace(machine, ' ', '_')|" ${worksrcpath}/Lib/distutils/util.py
		  reinplace "s|/bin/env python|&2.1|" ${worksrcpath}/Tools/scripts/pydoc }

configure.args	--with-suffix=.exe --with-dyld

destroot.destdir	prefix=${destroot}${prefix}

post-destroot	{ file delete ${destroot}${prefix}/bin/python.exe
		  file rename -force ${destroot}${prefix}/bin/python2.1.exe ${destroot}${prefix}/bin/python2.1
		  system "install -m 0755 ${worksrcpath}/Tools/scripts/pydoc ${destroot}${prefix}/bin/pydoc2.1"
		  file rename -force ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python2.1.1
}
