Index: trunk/dports/lang/python25/Portfile
===================================================================
--- trunk/dports/lang/python25/Portfile	(revision 37816)
+++ trunk/dports/lang/python25/Portfile	(revision 37817)
@@ -3,94 +3,135 @@
 PortSystem 1.0
 
-name			python25
-version			2.5.2
-revision		2
-categories		lang
-platforms		darwin
-maintainers		mww
+name                    python25
+version                 2.5.2
+revision                3
+set major               2
+set branch              2.5
+categories              lang
+platforms               darwin
+maintainers             mww
 
-description		An interpreted, object-oriented programming language
-long_description	Python is an interpreted, interactive, object-oriented \
-			programming language.
+description             An interpreted, object-oriented programming language
+long_description        Python is an interpreted, interactive, object-oriented \
+                        programming language.
 
-homepage		http://www.python.org/
-master_sites	${homepage}/ftp/python/${version}/ \
-			ftp://ftp.python.org/pub/python/${version}/ \
-			ftp://ftp.fastorama.com/mirrors/ftp.python.org/pub/python/${version}/ \
-			ftp://ftp.python.jp/pub/python/${version}/
+homepage                http://www.python.org/
+master_sites            ${homepage}/ftp/python/${version}/ \
+                        ftp://ftp.python.org/pub/python/${version}/ \
+                        ftp://ftp.fastorama.com/mirrors/ftp.python.org/pub/python/${version}/ \
+                        ftp://ftp.python.jp/pub/python/${version}/
 
-distname		Python-${version}
-use_bzip2		yes
+distname                Python-${version}
+extract.suffix          .tgz
 
-checksums       md5 afb5451049eda91fbde10bd5a4b7fadc \
-                sha1 4755d212f50af704c20224a6966e23acc5aea60f \
-                rmd160 b23b02739833e6730799c5866e2b77aae884b63f
+checksums               md5     3f7ca8aa86c6bd275426d63b46e07992 \
+                        sha1    7a835c93a904ae4ecb2d23b5183e94d3b92f8305 \
+                        rmd160  a6e2e81910639a362f265af2e3814e7b47e2110a
 
-depends_lib     port:gettext
+patchfiles              patch-Makefile.pre.in.diff \
+                        patch-setup.py.diff \
+                        patch-Lib-cgi.py.diff
 
-patchfiles      patch-configure.diff \
-                patch-Makefile.pre.in.diff \
-                patch-Misc-setuid-prog.c.diff \
-                patch-Modules-posixmodule.c.diff \
-                patch-setup.py.diff \
-                patch-Lib-cgi.py.diff
+depends_lib             port:gettext
 
-configure.args	--enable-shared \
-			--mandir=${prefix}/share/man \
-			--disable-framework
+configure.args          --enable-shared \
+                        --enable-framework=${prefix}/Library/Frameworks \
+                        --mandir=${prefix}/share/man \
+                        --without-readline \
+                        --disable-tk \
+                        --enable-ipv6
+
+use_parallel_build      no
 
 post-patch {
-    reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Lib/cgi.py
+        reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Lib/cgi.py
+        reinplace "s|/Applications/MacPython|/Applications/MacPorts/MacPython|g" \
+                Mac/Makefile.in Mac/IDLE/Makefile.in \
+                Mac/IDLE/Makefile.in Mac/Tools/Doc/setup.py \
+                Mac/PythonLauncher/Makefile.in \
+                Mac/BuildScript/build-installer.py
 }
 
-test.run	   yes
-test.target	   test
+build.target            all libpython${branch}.dylib
 
-destroot.target altinstall \
-                maninstall
+# TODO: From python24, do we still need this?
+# Workaround for case-sensitive file systems
+post-build {
+    if { ![file exists ${worksrcpath}/python.exe] } {
+        ln -s python ${worksrcpath}/python.exe
+    }
+}
+
+test.run                yes
+test.target             test
+
+destroot.target         frameworkinstall maninstall
 
 post-destroot {
-    set branche [join [lrange [split ${version} .] 0 1] .]
+        set framewpath ${prefix}/Library/Frameworks/Python.framework
+        set framewdir  ${framewpath}/Versions/${branch}
 
-    foreach bin {idle pydoc smtpd.py} {
-        move ${destroot}${prefix}/bin/${bin} \
-            ${destroot}${prefix}/bin/${bin}${branche}
-    }
-    move ${destroot}${prefix}/share/man/man1/python.1 \
-        ${destroot}${prefix}/share/man/man1/python${branche}.1
+        foreach dir { lib include } {
+            file rename ${destroot}${framewdir}/${dir}/python${branch} ${destroot}${prefix}/${dir}
+            ln -s ${destroot}${prefix}/${dir}/python${branch} ${destroot}${framewdir}/${dir}/python${branch}
+        }
 
-    # install select file for python_select
-    xinstall -m 755 -d ${destroot}${prefix}/etc/select/python
-    xinstall -m 644 ${filespath}/python25 ${destroot}${prefix}/etc/select/python/
+        file rename ${destroot}${framewdir}/lib/libpython${branch}.dylib ${destroot}${prefix}/lib
+        ln -s ${destroot}${prefix}/lib/libpython${branch}.dylib ${destroot}${framewdir}/lib/libpython${branch}.dylib
+
+        file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
+
+        # delete symlinks without version suffix, use python_select instead to choose version
+        foreach bin { python pythonw idle pydoc smtpd.py python-config } {
+            file delete ${destroot}${prefix}/bin/${bin}
+        }
+        foreach bin [list python${branch} pythonw${branch} idle${branch} pydoc${branch} smtpd${branch}.py python${branch}-config] {
+            file rename -force ${destroot}${framewdir}/bin/${bin} ${destroot}${prefix}/bin
+            ln -s ${prefix}/bin/${bin} ${destroot}${framewdir}/bin/${bin}
+        }
+
+        foreach dir { Headers Resources Python Versions/Current } {
+            file delete ${destroot}${framewpath}/${dir}
+        }
+
+        # install select file for python_select
+        xinstall -m 755 -d ${destroot}${prefix}/etc/select/python
+        xinstall -m 644 ${filespath}/python[string map {. {}} ${branch}] ${destroot}${prefix}/etc/select/python/
+}
+
+post-activate {
+    ui_msg "\nTo fully complete your installation and make python $branch the default, please run
+\n\tsudo port install python_select \
+\n\tsudo python_select $name\n"
 }
 
 platform darwin 7 {
-	# there is no SystemStubs on 10.3
-	post-patch { reinplace "s|-lSystemStubs||g" ${worksrcpath}/Makefile.pre.in }
-	# To avoid GCC incompatibility issue. See http://nxg.me.uk/note/2004/restFP/ (by ebgssth@gmail.com, ticket #13322)
-	configure.ldflags-append "-lcc_dynamic"
+        # there is no SystemStubs on 10.3
+        post-patch {
+                reinplace "s|-lSystemStubs||g" \
+                        configure configure.in
+        }
+        post-configure {
+                reinplace "s|-lSystemStubs||g" \
+                        Makefile.pre.in Makefile.pre Makefile
+        }
+        # To avoid GCC incompatibility issue. See http://nxg.me.uk/note/2004/restFP/ (by ebgssth@gmail.com, ticket #13322)
+        configure.ldflags-append "-lcc_dynamic"
 }
 
 platform darwin 8 {
-	configure.args-append 	--with-cxx=/usr/bin/g++-4.0
+        # TODO: would configure.compiler be more appropriate?
+        configure.args-append           --with-cxx=/usr/bin/g++-4.0
 }
 
 platform darwin 9 {
-	configure.cppflags-append	-D__DARWIN_UNIX03
-	configure.args-append 	--with-cxx=/usr/bin/g++-4.0
+        configure.cppflags-append       -D__DARWIN_UNIX03
 }
 
 variant universal {
-    configure.args-append   --enable-universalsdk
+        configure.args-append           --enable-universalsdk
 }
 
-# for w/o quicktime sdk, etc. (be prepared for framework build, though)
-platform puredarwin {
-#	configure.args-delete	--enable-framework=${prefix}/Library/Frameworks
-	configure.args-append	--disable-toolbox-glue --disable-framework
-}
-
-livecheck.check	regex
-livecheck.url   ${homepage}download/releases/
-livecheck.regex {Python (2\.5(?:\.\d+)*)}
-
+livecheck.check         regex
+livecheck.url           ${homepage}download/releases/
+livecheck.regex         Python (${branch}.\[0-9\]+)
Index: trunk/dports/lang/python25/files/python25
===================================================================
--- trunk/dports/lang/python25/files/python25	(revision 37816)
+++ trunk/dports/lang/python25/files/python25	(revision 37817)
@@ -1,4 +1,4 @@
 bin/python2.5
--
+bin/pythonw2.5
 bin/python2.5-config
 bin/idle2.5
@@ -7,6 +7,6 @@
 -
 share/man/man1/python2.5.1.gz
--
--
--
--
+Library/Frameworks/Python.framework/Versions/2.5
+Library/Frameworks/Python.framework/Versions/Versions/2.5/Headers
+Library/Frameworks/Python.framework/Versions/Versions/2.5/Resources
+Library/Frameworks/Python.framework/Versions/Versions/2.5/Python
