summaryrefslogtreecommitdiffstats
path: root/packaging/macosx/ports
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-11-23 23:36:49 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-11-23 23:36:49 +0000
commit0969085ddf607a7a98cf7fd6d9b10da5fbebe62d (patch)
tree59b2bc9ed3412ab2de4c703ef30342dfe2401704 /packaging/macosx/ports
parentrefactor from lastApplied (diff)
parentFixed a bug pointed by suv running from comand line, also removed another des... (diff)
downloadinkscape-0969085ddf607a7a98cf7fd6d9b10da5fbebe62d.tar.gz
inkscape-0969085ddf607a7a98cf7fd6d9b10da5fbebe62d.zip
fixing to trunk
(bzr r12588.1.34)
Diffstat (limited to 'packaging/macosx/ports')
-rw-r--r--packaging/macosx/ports/devel/inkscape-packaging/Portfile124
-rw-r--r--packaging/macosx/ports/lang/python25/Portfile214
-rw-r--r--packaging/macosx/ports/lang/python25/files/_localemodule.c.ed2
-rw-r--r--packaging/macosx/ports/lang/python25/files/locale.py.ed2
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-64bit.diff1234
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-FSIORefNum.diff11
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-Lib-cgi.py.diff18
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-Lib-distutils-dist.py.diff51
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-Makefile.pre.in.diff49
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-Misc-setuid-prog.c.diff16
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-Modules-posixmodule.c.diff21
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-configure.diff45
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-fwrapv.diff12
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-libedit.diff132
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-mac_ver.diff114
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-pyconfig.h.in.diff13
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-setup.py-disabled_modules.diff11
-rw-r--r--packaging/macosx/ports/lang/python25/files/patch-setup.py.diff80
-rw-r--r--packaging/macosx/ports/lang/python25/files/pyconfig.ed2
-rw-r--r--packaging/macosx/ports/lang/python25/files/pyconfig.h-universal.ed50
-rw-r--r--packaging/macosx/ports/lang/python25/files/python2513
-rw-r--r--packaging/macosx/ports/lang/python26/Portfile158
-rw-r--r--packaging/macosx/ports/lang/python26/files/patch-Lib-cgi.py.diff18
-rw-r--r--packaging/macosx/ports/lang/python26/files/patch-Lib-distutils-dist.py.diff51
-rw-r--r--packaging/macosx/ports/lang/python26/files/patch-Mac-IDLE-Makefile.in.diff11
-rw-r--r--packaging/macosx/ports/lang/python26/files/patch-Mac-Makefile.in.diff11
-rw-r--r--packaging/macosx/ports/lang/python26/files/patch-Mac-PythonLauncher-Makefile.in.diff11
-rw-r--r--packaging/macosx/ports/lang/python26/files/patch-Mac-Tools-Doc-setup.py.diff11
-rw-r--r--packaging/macosx/ports/lang/python26/files/patch-Makefile.pre.in.diff31
-rw-r--r--packaging/macosx/ports/lang/python26/files/patch-setup.py.diff16
-rw-r--r--packaging/macosx/ports/lang/python26/files/pyconfig.ed2
-rw-r--r--packaging/macosx/ports/lang/python26/files/python2612
-rw-r--r--packaging/macosx/ports/lang/python26/files/version.plist16
-rw-r--r--packaging/macosx/ports/python/py-Pillow/Portfile74
-rw-r--r--packaging/macosx/ports/python/py-Pillow/files/patch-setup.py.diff120
-rw-r--r--packaging/macosx/ports/python/py-sk1libs/Portfile64
-rw-r--r--packaging/macosx/ports/python/py-sk1libs/files/patch-src-imaging-libimagingft-_imagingft.c.diff16
-rw-r--r--packaging/macosx/ports/python/py-sk1libs/files/patch-src-utils-fs.py.diff26
-rw-r--r--packaging/macosx/ports/python/py-uniconvertor/Portfile46
-rw-r--r--packaging/macosx/ports/python/py25-Pillow/Portfile77
-rw-r--r--packaging/macosx/ports/python/py25-Pillow/files/patch-_imagingft.c.diff14
-rw-r--r--packaging/macosx/ports/python/py25-Pillow/files/patch-setup.py-v1.7.8.diff83
-rw-r--r--packaging/macosx/ports/python/py25-lxml/Portfile51
-rw-r--r--packaging/macosx/ports/python/py25-nose/Portfile86
-rw-r--r--packaging/macosx/ports/python/py25-nose/files/nosetests241
-rw-r--r--packaging/macosx/ports/python/py25-nose/files/nosetests251
-rw-r--r--packaging/macosx/ports/python/py25-nose/files/nosetests261
-rw-r--r--packaging/macosx/ports/python/py25-nose/files/nosetests271
-rw-r--r--packaging/macosx/ports/python/py25-nose/files/nosetests311
-rw-r--r--packaging/macosx/ports/python/py25-nose/files/nosetests321
-rw-r--r--packaging/macosx/ports/python/py25-nose/files/nosetests331
-rw-r--r--packaging/macosx/ports/python/py25-nose/files/nosetests341
-rw-r--r--packaging/macosx/ports/python/py25-numpy/Portfile209
-rw-r--r--packaging/macosx/ports/python/py25-numpy/files/patch-f2py_setup.py.diff29
-rw-r--r--packaging/macosx/ports/python/py25-numpy/files/patch-fcompiler_g95.diff11
-rw-r--r--packaging/macosx/ports/python/py25-numpy/files/patch-numpy_distutils_fcompiler___init__.py.diff30
-rw-r--r--packaging/macosx/ports/python/py25-numpy/files/patch-numpy_linalg_setup.py.diff10
-rw-r--r--packaging/macosx/ports/python/py25-numpy/files/patch-setup.py.diff34
-rwxr-xr-xpackaging/macosx/ports/python/py25-numpy/files/wrapper-template143
-rw-r--r--packaging/macosx/ports/python/py25-setuptools/Portfile58
60 files changed, 3751 insertions, 0 deletions
diff --git a/packaging/macosx/ports/devel/inkscape-packaging/Portfile b/packaging/macosx/ports/devel/inkscape-packaging/Portfile
new file mode 100644
index 000000000..9a2bf0cf1
--- /dev/null
+++ b/packaging/macosx/ports/devel/inkscape-packaging/Portfile
@@ -0,0 +1,124 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id: $
+
+PortSystem 1.0
+
+name inkscape-packaging
+version 0.91
+revision 100
+
+categories devel graphics
+platforms darwin
+license GPL-2
+supported_archs noarch
+
+maintainers users.sf.net:suv-sf
+
+description Dependencies for Inkscape.app
+long_description ${description}
+
+homepage http://inkscape.org
+
+# this is a metaport - no fetch, configure and build phases
+master_sites
+distfiles
+use_configure no
+build {}
+destroot {
+ # Create a dummy file so the port can be successfully activated
+ xinstall -d ${destroot}${prefix}/share/doc/${name}
+ set docfile [open ${destroot}${prefix}/share/doc/${name}/README.txt "w"]
+ puts $docfile "Inkscape packaging ${version} (meta port for all dependencies)\n"
+ close $docfile
+}
+
+# build dependencies
+depends_build port:bzr \
+ port:autoconf \
+ port:automake \
+ port:pkgconfig \
+ port:libtool \
+ port:intltool \
+ port:perl5
+
+# core dependencies
+depends_build-append port:popt \
+ port:boehmgc \
+ port:gsl \
+ port:lcms2 \
+ port:gtkmm \
+ port:boost \
+ port:ImageMagick \
+ port:gtkspell2 \
+ port:aspell-dict-en \
+ port:poppler
+
+# ports for Inkscape.app
+depends_build-append port:gnome-icon-theme \
+ port:gnome-icon-theme-symbolic \
+ port:icon-naming-utils \
+ port:gnome-themes-standard \
+ port:gtk-engines2 \
+ port:gtk2-murrine
+
+# ports for python extensions
+depends_build-append port:py27-lxml \
+ port:py27-numpy \
+ port:py27-Pillow \
+ port:py27-uniconvertor \
+ port:py27-pygtk
+
+if {${os.major} <= 10} {
+ # ports for python extensions on Snow Leopard and Leopard
+ depends_build-append port:py26-lxml \
+ port:py26-numpy \
+ port:py26-Pillow \
+ port:py26-uniconvertor
+}
+if {${os.major} == 9} {
+ # ports for python extensions build deps on Leopard
+ depends_build-append port:gawk \
+ port:py25-lxml \
+ port:py25-numpy \
+ port:py25-Pillow \
+ port:py25-uniconvertor
+}
+if {${os.major} < 9} {
+ # we don't support Tiger anymore
+ return -code error "Mac OS X <= 10.4 not supported."
+}
+
+# optional features
+variant libwpd conflicts librevenge description {use libpwd for WPG, CDR, VSD} {
+depends_build-append port:libcdr \
+ port:libvisio \
+ port:libwpg
+}
+
+variant librevenge conflicts libwpd description {use librevenge for WPG, CDR, VSD} {
+depends_build-append port:libcdr-0.1 \
+ port:libvisio-0.1 \
+ port:libwpg-0.3
+}
+
+variant gnome_vfs description {with gnome-vfs (deprecated)} {
+ depends_build-append port:gnome-vfs
+}
+
+variant gvfs description {with gvfs} {
+ depends_build-append port:gvfs
+}
+
+variant dbus description {with dbus} {
+ depends_build-append port:dbus \
+ port:dbus-glib \
+ port:dbus-python27
+}
+
+# variants
+universal_variant no
+
+default_variants-append +gnome_vfs
+
+# livecheck
+livecheck.type none
diff --git a/packaging/macosx/ports/lang/python25/Portfile b/packaging/macosx/ports/lang/python25/Portfile
new file mode 100644
index 000000000..a27bdaf64
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/Portfile
@@ -0,0 +1,214 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id: Portfile 104926 2013-04-05 04:43:09Z larryv@macports.org $
+
+PortSystem 1.0
+PortGroup select 1.0
+
+name python25
+version 2.5.6
+revision 100
+
+set branch [join [lrange [split ${version} .] 0 1] .]
+categories lang
+license PSF
+platforms darwin
+maintainers nomaintainer
+
+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 http://ftp.python.org/ftp/python/${version}/
+
+distname Python-${version}
+use_bzip2 yes
+
+checksums md5 5d45979c5f30fb2dd5f067c6b06b88e4 \
+ sha1 29f6dd41bf09c5e04311b367cbb7604fa016e699 \
+ rmd160 92f0a955971f187a7d50c6422168202ec551bf22
+
+# patch-Lib-distutils-dist.py.diff comes from
+# <http://bugs.python.org/issue1180>
+patchfiles patch-Makefile.pre.in.diff \
+ patch-Lib-cgi.py.diff \
+ patch-Lib-distutils-dist.py.diff \
+ patch-setup.py.diff \
+ patch-configure.diff \
+ patch-64bit.diff \
+ patch-setup.py-disabled_modules.diff \
+ patch-mac_ver.diff \
+ patch-libedit.diff \
+ patch-fwrapv.diff
+
+depends_lib port:gettext port:zlib port:openssl \
+ port:sqlite3 port:db46 port:bzip2 \
+ port:libedit port:ncurses
+depends_run port:python_select
+
+configure.args --enable-shared \
+ --enable-framework=${frameworks_dir} \
+ --mandir=${prefix}/share/man \
+ --enable-ipv6 \
+ --with-cxx=${configure.cxx}
+
+post-patch {
+ reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Lib/cgi.py \
+ ${worksrcpath}/setup.py
+ reinplace "s|/Applications/MacPython|${applications_dir}/MacPython|g" \
+ ${worksrcpath}/Mac/Makefile.in \
+ ${worksrcpath}/Mac/IDLE/Makefile.in \
+ ${worksrcpath}/Mac/Tools/Doc/setup.py \
+ ${worksrcpath}/Mac/PythonLauncher/Makefile.in \
+ ${worksrcpath}/Mac/BuildScript/build-installer.py
+ reinplace "s|xargs -0 rm -r|xargs -0 rm -rf|g" \
+ ${worksrcpath}/Mac/PythonLauncher/Makefile.in
+ reinplace "s|__BUILD_ARCH__|${build_arch}|" ${worksrcpath}/configure
+ reinplace "s|__UNIVERSAL_CFLAGS__|${configure.universal_cflags}|" ${worksrcpath}/configure
+ reinplace "s|__UNIVERSAL_LDFLAGS__|${configure.universal_ldflags}|" \
+ ${worksrcpath}/configure \
+ ${worksrcpath}/Makefile.pre.in
+
+ # http://trac.macports.org/ticket/21517
+ system -W ${worksrcpath} "ed - Modules/_localemodule.c < ${filespath}/_localemodule.c.ed"
+ system -W ${worksrcpath} "ed - Lib/locale.py < ${filespath}/locale.py.ed"
+}
+
+build.target all
+
+# 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
+
+# ensure that correct compiler is used
+build.args-append MAKE="${build.cmd}" CC="${configure.cc}"
+destroot.args-append MAKE="${destroot.cmd}" CC="${configure.cc}"
+
+select.group python
+select.file ${filespath}/python[string map {. {}} ${branch}]
+
+notes "
+To make python ${branch} the default (i.e. the version you get when you run\
+'python'), please run:
+
+sudo port select --set ${select.group} [file tail ${select.file}]
+"
+
+platform macosx {
+post-destroot {
+
+ set framewpath ${frameworks_dir}/Python.framework
+ set framewdir ${framewpath}/Versions/${branch}
+
+ # Without this, LINKFORSHARED is set to
+ # ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
+ # (this becomes Python.framework/Versions/2.5/Python) which doesn't
+ # quite work (see ticket #15099); instead specifically list the
+ # full path to the proper Python framework file (which becomes
+ # ${prefix}/Library/Frameworks/Python.framework/Versions/2.5/Python)
+ reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${framewdir}/lib/python${branch}/config/Makefile
+
+ foreach dir { lib include } {
+ file rename ${destroot}${framewdir}/${dir}/python${branch} ${destroot}${prefix}/${dir}
+ ln -s ${prefix}/${dir}/python${branch} ${destroot}${framewdir}/${dir}/python${branch}
+ }
+ ln -s ${prefix}/share ${destroot}${framewdir}/share
+
+ ln -s ${framewdir}/Python ${destroot}${prefix}/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}
+ }
+
+ # Fix incorrectly-pointed libpython2.5.a symlink, see
+ # http://trac.macports.org/ticket/19906
+ set python_staticlink ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
+ file delete ${python_staticlink}
+ ln -s ${framewdir}/Python ${python_staticlink}
+}
+}
+
+platform darwin {
+ post-configure {
+ # See http://trac.macports.org/ticket/18376
+ system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.ed"
+ }
+ if {${os.major} >= 10} {
+ configure.cppflags-append -D_DARWIN_C_SOURCE
+ patchfiles-append patch-pyconfig.h.in.diff
+ }
+ post-patch {
+ if {![file exists /usr/lib/libSystemStubs.a]} {
+ reinplace s/-lSystemStubs//g ${worksrcpath}/configure
+ }
+ }
+ post-destroot {
+ # remove -arch flags from the config
+ reinplace -E {s|-arch [a-z0-9_]+||g} \
+ ${destroot}${prefix}/lib/python${branch}/config/Makefile
+ }
+}
+
+platform darwin 8 {
+ patchfiles-append patch-FSIORefNum.diff
+}
+
+platform darwin 9 {
+ configure.cppflags-append -D__DARWIN_UNIX03
+}
+
+platform puredarwin {
+ patchfiles-append patch-Modules-posixmodule.c.diff
+ configure.args-delete --enable-framework=${frameworks_dir}
+ configure.args-append --disable-toolbox-glue --disable-framework
+ destroot.target install maninstall
+
+post-build {
+ # thin dynamic library to have the same arch as static lib, even after -lSystemStubs
+ system "lipo ${worksrcpath}/libpython${branch}.dylib -output ${worksrcpath}/libpython${branch}.dylib -thin `lipo -info ${worksrcpath}/libpython${branch}.a | tail -n 1 | sed -e 's/.*architecture: \\(.*\\)/\\1/'`"
+}
+
+post-destroot {
+ # 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}
+ }
+
+ file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
+}
+}
+
+variant universal {
+ if {${configure.sdkroot} == ""} {
+ configure.args-append --enable-universalsdk=/
+ } else {
+ configure.args-append --enable-universalsdk=${configure.sdkroot}
+ }
+ post-configure {
+ system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.h-universal.ed"
+ }
+}
+
+livecheck.type regex
+livecheck.url ${homepage}download/releases/
+livecheck.regex Python (${branch}.\[0-9\]+)
diff --git a/packaging/macosx/ports/lang/python25/files/_localemodule.c.ed b/packaging/macosx/ports/lang/python25/files/_localemodule.c.ed
new file mode 100644
index 000000000..d4617a931
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/_localemodule.c.ed
@@ -0,0 +1,2 @@
+g/defined(__APPLE__)/s//0/g
+w
diff --git a/packaging/macosx/ports/lang/python25/files/locale.py.ed b/packaging/macosx/ports/lang/python25/files/locale.py.ed
new file mode 100644
index 000000000..0bdbf3ea0
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/locale.py.ed
@@ -0,0 +1,2 @@
+g/'darwin', /s///
+w
diff --git a/packaging/macosx/ports/lang/python25/files/patch-64bit.diff b/packaging/macosx/ports/lang/python25/files/patch-64bit.diff
new file mode 100644
index 000000000..100617df6
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-64bit.diff
@@ -0,0 +1,1234 @@
+--- Include/pymactoolbox.h.orig 2004-11-05 18:02:59.000000000 +1100
++++ Include/pymactoolbox.h 2009-09-10 18:08:58.000000000 +1000
+@@ -8,7 +8,9 @@
+ #endif
+
+ #include <Carbon/Carbon.h>
++#ifndef __LP64__
+ #include <QuickTime/QuickTime.h>
++#endif /* !__LP64__ */
+
+ /*
+ ** Helper routines for error codes and such.
+@@ -18,8 +20,10 @@
+ PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
+ PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
+ PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
++#ifndef __LP64__
+ extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
+ fsspec->path */
++#endif /* !__LP64__ */
+ /*
+ ** These conversion routines are defined in mactoolboxglue.c itself.
+ */
+@@ -83,9 +87,10 @@
+ #endif /* USE_TOOLBOX_OBJECT_GLUE */
+
+ /* macfs exports */
++#ifndef __LP64__
+ int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
+ PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
+-
++#endif /* !__LP64__ */
+ int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */
+ PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */
+
+@@ -101,39 +106,54 @@
+ extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
+
+ /* Ctl exports */
++#ifndef __LP64__
+ extern PyObject *CtlObj_New(ControlHandle);
+ extern int CtlObj_Convert(PyObject *, ControlHandle *);
++#endif /* !__LP64__ */
+
+ /* Dlg exports */
++#ifndef __LP64__
+ extern PyObject *DlgObj_New(DialogPtr);
+ extern int DlgObj_Convert(PyObject *, DialogPtr *);
+ extern PyObject *DlgObj_WhichDialog(DialogPtr);
++#endif /* !__LP64__ */
+
+ /* Drag exports */
++#ifndef __LP64__
+ extern PyObject *DragObj_New(DragReference);
+ extern int DragObj_Convert(PyObject *, DragReference *);
++#endif /* !__LP64__ */
+
+ /* List exports */
++#ifndef __LP64__
+ extern PyObject *ListObj_New(ListHandle);
+ extern int ListObj_Convert(PyObject *, ListHandle *);
++#endif /* !__LP64__ */
+
+ /* Menu exports */
++#ifndef __LP64__
+ extern PyObject *MenuObj_New(MenuHandle);
+ extern int MenuObj_Convert(PyObject *, MenuHandle *);
++#endif /* !__LP64__ */
+
+ /* Qd exports */
++#ifndef __LP64__
+ extern PyObject *GrafObj_New(GrafPtr);
+ extern int GrafObj_Convert(PyObject *, GrafPtr *);
+ extern PyObject *BMObj_New(BitMapPtr);
+ extern int BMObj_Convert(PyObject *, BitMapPtr *);
+ extern PyObject *QdRGB_New(RGBColor *);
+ extern int QdRGB_Convert(PyObject *, RGBColor *);
++#endif /* !__LP64__ */
+
+ /* Qdoffs exports */
++#ifndef __LP64__
+ extern PyObject *GWorldObj_New(GWorldPtr);
+ extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
++#endif /* !__LP64__ */
+
+ /* Qt exports */
++#ifndef __LP64__
+ extern PyObject *TrackObj_New(Track);
+ extern int TrackObj_Convert(PyObject *, Track *);
+ extern PyObject *MovieObj_New(Movie);
+@@ -146,6 +166,7 @@
+ extern int UserDataObj_Convert(PyObject *, UserData *);
+ extern PyObject *MediaObj_New(Media);
+ extern int MediaObj_Convert(PyObject *, Media *);
++#endif /* !__LP64__ */
+
+ /* Res exports */
+ extern PyObject *ResObj_New(Handle);
+@@ -154,13 +175,17 @@
+ extern int OptResObj_Convert(PyObject *, Handle *);
+
+ /* TE exports */
++#ifndef __LP64__
+ extern PyObject *TEObj_New(TEHandle);
+ extern int TEObj_Convert(PyObject *, TEHandle *);
++#endif /* !__LP64__ */
+
+ /* Win exports */
++#ifndef __LP64__
+ extern PyObject *WinObj_New(WindowPtr);
+ extern int WinObj_Convert(PyObject *, WindowPtr *);
+ extern PyObject *WinObj_WhichWindow(WindowPtr);
++#endif /* !__LP64__ */
+
+ /* CF exports */
+ extern PyObject *CFObj_New(CFTypeRef);
+--- Python/mactoolboxglue.c.orig 2006-07-12 02:44:25.000000000 +1000
++++ Python/mactoolboxglue.c 2009-09-10 19:26:39.000000000 +1000
+@@ -105,7 +105,7 @@
+ return PyErr_Mac(PyMac_GetOSErrException(), err);
+ }
+
+-
++#ifndef __LP64__
+ OSErr
+ PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
+ {
+@@ -153,6 +153,7 @@
+ Py_XDECREF(fs);
+ return err;
+ }
++#endif /* !__LP64__ */
+
+ /* Convert a 4-char string object argument to an OSType value */
+ int
+@@ -417,6 +418,7 @@
+ GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
+ GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
+
++#ifndef __LP64__
+ GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
+ GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
+ GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
+@@ -429,6 +431,7 @@
+ GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
+ GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
+ GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
++#endif /* !__LP64__ */
+
+ GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
+ GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")
+--- Modules/_ctypes/libffi/src/darwin/ffitarget.h.orig 2006-05-26 07:58:05.000000000 +1000
++++ Modules/_ctypes/libffi/src/darwin/ffitarget.h 2009-09-10 20:15:39.000000000 +1000
+@@ -4,7 +4,7 @@
+ * created by configure). This makes is possible to build a univeral binary
+ * of ctypes in one go.
+ */
+-#if defined(__i386__)
++#if defined(__i386__) || defined(__x86_64__)
+
+ #ifndef X86_DARWIN
+ #define X86_DARWIN
+@@ -13,7 +13,7 @@
+
+ #include "../src/x86/ffitarget.h"
+
+-#elif defined(__ppc__)
++#elif defined(__ppc__) || defined(__ppc64__)
+
+ #ifndef POWERPC_DARWIN
+ #define POWERPC_DARWIN
+--- Mac/Modules/res/_Resmodule.c.orig 2005-07-04 06:59:44.000000000 +1000
++++ Mac/Modules/res/_Resmodule.c 2009-09-10 20:44:43.000000000 +1000
+@@ -414,6 +414,7 @@
+ return _res;
+ }
+
++#ifndef __LP64__
+ static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+@@ -431,6 +432,7 @@
+ return _res;
+
+ }
++#endif /* !__LP64__ */
+
+ static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
+ {
+@@ -501,10 +503,12 @@
+ PyDoc_STR("(long newSize) -> None")},
+ {"GetNextFOND", (PyCFunction)ResObj_GetNextFOND, 1,
+ PyDoc_STR("() -> (Handle _rv)")},
++#ifndef __LP64__
+ {"as_Control", (PyCFunction)ResObj_as_Control, 1,
+ PyDoc_STR("Return this resource/handle as a Control")},
+ {"as_Menu", (PyCFunction)ResObj_as_Menu, 1,
+ PyDoc_STR("Return this resource/handle as a Menu")},
++#endif /* !__LP64__ */
+ {"LoadResource", (PyCFunction)ResObj_LoadResource, 1,
+ PyDoc_STR("() -> None")},
+ {"AutoDispose", (PyCFunction)ResObj_AutoDispose, 1,
+@@ -1152,6 +1156,7 @@
+ return _res;
+ }
+
++#ifndef __LP64__
+ static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+@@ -1287,6 +1292,7 @@
+ _res = Py_None;
+ return _res;
+ }
++#endif /* !__LP64__ */
+
+ static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
+ {
+@@ -1327,6 +1333,7 @@
+ return _res;
+ }
+
++#ifndef __LP64__
+ static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+@@ -1413,6 +1420,7 @@
+ nextRefNum);
+ return _res;
+ }
++#endif /* !__LP64__ */
+
+ static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
+ {
+@@ -1438,6 +1446,7 @@
+ return _res;
+ }
+
++#ifndef __LP64__
+ static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+@@ -1534,6 +1543,7 @@
+ PyMac_BuildFSSpec, &newSpec);
+ return _res;
+ }
++#endif /* !__LP64__ */
+
+ static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
+ {
+@@ -1637,6 +1647,7 @@
+ PyDoc_STR("(short refNum) -> (short _rv)")},
+ {"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1,
+ PyDoc_STR("(short refNum, short attrs) -> None")},
++#ifndef __LP64__
+ {"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
+ PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")},
+ {"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
+@@ -1647,10 +1658,12 @@
+ PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")},
+ {"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1,
+ PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")},
++#endif /* !__LP64__ */
+ {"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1,
+ PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")},
+ {"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1,
+ PyDoc_STR("(SInt16 refNum) -> None")},
++#ifndef __LP64__
+ {"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1,
+ PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
+ {"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1,
+@@ -1659,14 +1672,17 @@
+ PyDoc_STR("() -> (SInt16 refNum)")},
+ {"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
+ PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")},
++#endif /* !__LP64__ */
+ {"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
+ PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")},
++#ifndef __LP64__
+ {"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1,
+ PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")},
+ {"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
+ PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
+ {"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1,
+ PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")},
++#endif /* !__LP64__ */
+ {"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1,
+ PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")},
+ {"Handle", (PyCFunction)Res_Handle, 1,
+--- Mac/Modules/MacOS.c.orig 2006-07-26 05:20:54.000000000 +1000
++++ Mac/Modules/MacOS.c 2009-09-10 21:47:34.000000000 +1000
+@@ -54,7 +54,7 @@
+ do_close(rfobject *self)
+ {
+ if (self->isclosed ) return;
+- (void)FSClose(self->fRefNum);
++ (void)FSCloseFork(self->fRefNum);
+ self->isclosed = 1;
+ }
+
+@@ -68,6 +68,7 @@
+ long n;
+ PyObject *v;
+ OSErr err;
++ ByteCount n2;
+
+ if (self->isclosed) {
+ PyErr_SetString(PyExc_ValueError, "Operation on closed file");
+@@ -81,13 +82,13 @@
+ if (v == NULL)
+ return NULL;
+
+- err = FSRead(self->fRefNum, &n, PyString_AsString(v));
++ err = FSReadFork(self->fRefNum, fsAtMark, 0, n, PyString_AsString(v), &n2);
+ if (err && err != eofErr) {
+ PyMac_Error(err);
+ Py_DECREF(v);
+ return NULL;
+ }
+- _PyString_Resize(&v, n);
++ _PyString_Resize(&v, n2);
+ return v;
+ }
+
+@@ -109,7 +110,7 @@
+ }
+ if (!PyArg_ParseTuple(args, "s#", &buffer, &size))
+ return NULL;
+- err = FSWrite(self->fRefNum, &size, buffer);
++ err = FSWriteFork(self->fRefNum, fsAtMark, 0, size, buffer, NULL);
+ if (err) {
+ PyMac_Error(err);
+ return NULL;
+@@ -126,9 +127,9 @@
+ static PyObject *
+ rf_seek(rfobject *self, PyObject *args)
+ {
+- long amount, pos;
++ long amount;
+ int whence = SEEK_SET;
+- long eof;
++ int mode;
+ OSErr err;
+
+ if (self->isclosed) {
+@@ -138,35 +139,23 @@
+ if (!PyArg_ParseTuple(args, "l|i", &amount, &whence))
+ return NULL;
+
+- if ((err = GetEOF(self->fRefNum, &eof)))
+- goto ioerr;
+-
+ switch (whence) {
+ case SEEK_CUR:
+- if ((err = GetFPos(self->fRefNum, &pos)))
+- goto ioerr;
++ mode = fsFromMark;
+ break;
+ case SEEK_END:
+- pos = eof;
++ mode = fsFromLEOF;
+ break;
+ case SEEK_SET:
+- pos = 0;
++ mode = fsFromStart;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
+ }
+
+- pos += amount;
+-
+- /* Don't bother implementing seek past EOF */
+- if (pos > eof || pos < 0) {
+- PyErr_BadArgument();
+- return NULL;
+- }
+-
+- if ((err = SetFPos(self->fRefNum, fsFromStart, pos)) ) {
+-ioerr:
++ err = FSSetForkPosition(self->fRefNum, mode, amount);
++ if (err != noErr) {
+ PyMac_Error(err);
+ return NULL;
+ }
+@@ -182,7 +171,7 @@
+ static PyObject *
+ rf_tell(rfobject *self, PyObject *args)
+ {
+- long where;
++ long long where;
+ OSErr err;
+
+ if (self->isclosed) {
+@@ -191,11 +180,13 @@
+ }
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+- if ((err = GetFPos(self->fRefNum, &where)) ) {
++
++ err = FSGetForkPosition(self->fRefNum, &where);
++ if (err != noErr) {
+ PyMac_Error(err);
+ return NULL;
+ }
+- return PyInt_FromLong(where);
++ return PyLong_FromLongLong(where);
+ }
+
+ static char rf_close__doc__[] =
+@@ -292,17 +283,61 @@
+ static PyObject *
+ MacOS_GetCreatorAndType(PyObject *self, PyObject *args)
+ {
+- FSSpec fss;
+- FInfo info;
+ PyObject *creator, *type, *res;
+ OSErr err;
+-
+- if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
++ FSRef ref;
++ FSCatalogInfo cataloginfo;
++ FileInfo* finfo;
++
++ if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSRef, &ref)) {
++#ifndef __LP64__
++ /* This function is documented to take an FSSpec as well,
++ * which only works in 32-bit mode.
++ */
++ PyErr_Clear();
++ FSSpec fss;
++ FInfo info;
++
++ if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
++ return NULL;
++
++ if ((err = FSpGetFInfo(&fss, &info)) != noErr) {
++ return PyErr_Mac(MacOS_Error, err);
++ }
++ creator = PyString_FromStringAndSize(
++ (char *)&info.fdCreator, 4);
++ type = PyString_FromStringAndSize((char *)&info.fdType, 4);
++ res = Py_BuildValue("OO", creator, type);
++ Py_DECREF(creator);
++ Py_DECREF(type);
++ return res;
++#else /* __LP64__ */
++ return NULL;
++#endif /* __LP64__ */
++ }
++
++ err = FSGetCatalogInfo(&ref,
++ kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo,
++ NULL, NULL, NULL);
++ if (err != noErr) {
++ PyErr_Mac(MacOS_Error, err);
+ return NULL;
+- if ((err = FSpGetFInfo(&fss, &info)) != noErr)
+- return PyErr_Mac(MacOS_Error, err);
+- creator = PyString_FromStringAndSize((char *)&info.fdCreator, 4);
+- type = PyString_FromStringAndSize((char *)&info.fdType, 4);
++ }
++
++ if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) {
++ /* Directory: doesn't have type/creator info.
++ *
++ * The specific error code is for backward compatibility with
++ * earlier versions.
++ */
++ PyErr_Mac(MacOS_Error, fnfErr);
++ return NULL;
++
++ }
++ finfo = (FileInfo*)&(cataloginfo.finderInfo);
++ creator = PyString_FromStringAndSize((char*)&(finfo->fileCreator), 4);
++ type = PyString_FromStringAndSize((char*)&(finfo->fileType), 4);
++
+ res = Py_BuildValue("OO", creator, type);
+ Py_DECREF(creator);
+ Py_DECREF(type);
+@@ -314,20 +349,66 @@
+ static PyObject *
+ MacOS_SetCreatorAndType(PyObject *self, PyObject *args)
+ {
+- FSSpec fss;
+ ResType creator, type;
+- FInfo info;
++ FSRef ref;
++ FileInfo* finfo;
+ OSErr err;
+-
++ FSCatalogInfo cataloginfo;
++
+ if (!PyArg_ParseTuple(args, "O&O&O&",
++ PyMac_GetFSRef, &ref, PyMac_GetOSType, &creator, PyMac_GetOSType, &type)) {
++#ifndef __LP64__
++ /* Try to handle FSSpec arguments, for backward compatibility */
++ FSSpec fss;
++ FInfo info;
++
++ if (!PyArg_ParseTuple(args, "O&O&O&",
+ PyMac_GetFSSpec, &fss, PyMac_GetOSType, &creator, PyMac_GetOSType, &type))
++ return NULL;
++
++ if ((err = FSpGetFInfo(&fss, &info)) != noErr)
++ return PyErr_Mac(MacOS_Error, err);
++
++ info.fdCreator = creator;
++ info.fdType = type;
++
++ if ((err = FSpSetFInfo(&fss, &info)) != noErr)
++ return PyErr_Mac(MacOS_Error, err);
++ Py_INCREF(Py_None);
++ return Py_None;
++#else /* __LP64__ */
++ return NULL;
++#endif /* __LP64__ */
++ }
++
++ err = FSGetCatalogInfo(&ref,
++ kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo,
++ NULL, NULL, NULL);
++ if (err != noErr) {
++ PyErr_Mac(MacOS_Error, err);
+ return NULL;
+- if ((err = FSpGetFInfo(&fss, &info)) != noErr)
+- return PyErr_Mac(MacOS_Error, err);
+- info.fdCreator = creator;
+- info.fdType = type;
+- if ((err = FSpSetFInfo(&fss, &info)) != noErr)
+- return PyErr_Mac(MacOS_Error, err);
++ }
++
++ if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) {
++ /* Directory: doesn't have type/creator info.
++ *
++ * The specific error code is for backward compatibility with
++ * earlier versions.
++ */
++ PyErr_Mac(MacOS_Error, fnfErr);
++ return NULL;
++
++ }
++ finfo = (FileInfo*)&(cataloginfo.finderInfo);
++ finfo->fileCreator = creator;
++ finfo->fileType = type;
++
++ err = FSSetCatalogInfo(&ref, kFSCatInfoFinderInfo, &cataloginfo);
++ if (err != noErr) {
++ PyErr_Mac(MacOS_Error, fnfErr);
++ return NULL;
++ }
++
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+@@ -399,6 +480,7 @@
+ return Py_BuildValue("s", buf);
+ }
+
++#ifndef __LP64__
+ static char splash_doc[] = "Open a splash-screen dialog by resource-id (0=close)";
+
+ static PyObject *
+@@ -470,6 +552,7 @@
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
++#endif /* !__LP64__ */
+
+ static char WMAvailable_doc[] =
+ "True if this process can interact with the display."
+@@ -530,17 +613,18 @@
+ {
+ OSErr err;
+ char *mode = "r";
+- FSSpec fss;
+- SignedByte permission = 1;
++ FSRef ref;
++ SInt8 permission = fsRdPerm;
+ rfobject *fp;
++ HFSUniStr255 name;
+
+- if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSSpec, &fss, &mode))
++ if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSRef, &ref, &mode))
+ return NULL;
+ while (*mode) {
+ switch (*mode++) {
+ case '*': break;
+- case 'r': permission = 1; break;
+- case 'w': permission = 2; break;
++ case 'r': permission = fsRdPerm; break;
++ case 'w': permission = fsWrPerm; break;
+ case 'b': break;
+ default:
+ PyErr_BadArgument();
+@@ -548,33 +632,18 @@
+ }
+ }
+
+- if ( (fp = newrfobject()) == NULL )
++ err = FSGetResourceForkName(&name);
++ if (err != noErr) {
++ PyMac_Error(err);
+ return NULL;
++ }
+
+- err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
++ if ( (fp = newrfobject()) == NULL )
++ return NULL;
++
+
+- if ( err == fnfErr ) {
+- /* In stead of doing complicated things here to get creator/type
+- ** correct we let the standard i/o library handle it
+- */
+- FILE *tfp;
+- char pathname[PATHNAMELEN];
+-
+- if ( (err=PyMac_GetFullPathname(&fss, pathname, PATHNAMELEN)) ) {
+- PyMac_Error(err);
+- Py_DECREF(fp);
+- return NULL;
+- }
+-
+- if ( (tfp = fopen(pathname, "w")) == NULL ) {
+- PyMac_Error(fnfErr); /* What else... */
+- Py_DECREF(fp);
+- return NULL;
+- }
+- fclose(tfp);
+- err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
+- }
+- if ( err ) {
++ err = FSOpenFork(&ref, name.length, name.unicode, permission, &fp->fRefNum);
++ if (err != noErr) {
+ Py_DECREF(fp);
+ PyMac_Error(err);
+ return NULL;
+@@ -589,10 +658,12 @@
+ {"SetCreatorAndType", MacOS_SetCreatorAndType, 1, setcrtp_doc},
+ {"GetErrorString", MacOS_GetErrorString, 1, geterr_doc},
+ {"openrf", MacOS_openrf, 1, openrf_doc},
++#ifndef __LP64__
+ {"splash", MacOS_splash, 1, splash_doc},
+ {"DebugStr", MacOS_DebugStr, 1, DebugStr_doc},
+- {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
+ {"SysBeep", MacOS_SysBeep, 1, SysBeep_doc},
++#endif /* !__LP64__ */
++ {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
+ {"WMAvailable", MacOS_WMAvailable, 1, WMAvailable_doc},
+ {NULL, NULL} /* Sentinel */
+ };
+--- Mac/Modules/file/_Filemodule.c.orig 2006-05-29 07:57:35.000000000 +1000
++++ Mac/Modules/file/_Filemodule.c 2009-09-10 22:48:47.000000000 +1000
+@@ -18,9 +18,11 @@
+ #include <Carbon/Carbon.h>
+
+ #ifdef USE_TOOLBOX_OBJECT_GLUE
++#ifndef __LP64__
+ extern int _PyMac_GetFSSpec(PyObject *v, FSSpec *spec);
+-extern int _PyMac_GetFSRef(PyObject *v, FSRef *fsr);
+ extern PyObject *_PyMac_BuildFSSpec(FSSpec *spec);
++#endif /* !__LP64__ */
++extern int _PyMac_GetFSRef(PyObject *v, FSRef *fsr);
+ extern PyObject *_PyMac_BuildFSRef(FSRef *spec);
+
+ #define PyMac_GetFSSpec _PyMac_GetFSSpec
+@@ -28,20 +30,26 @@
+ #define PyMac_BuildFSSpec _PyMac_BuildFSSpec
+ #define PyMac_BuildFSRef _PyMac_BuildFSRef
+ #else
++#ifndef __LP64__
+ extern int PyMac_GetFSSpec(PyObject *v, FSSpec *spec);
+-extern int PyMac_GetFSRef(PyObject *v, FSRef *fsr);
+ extern PyObject *PyMac_BuildFSSpec(FSSpec *spec);
++#endif /* !__LP64__ */
++extern int PyMac_GetFSRef(PyObject *v, FSRef *fsr);
+ extern PyObject *PyMac_BuildFSRef(FSRef *spec);
+ #endif
+
+ /* Forward declarations */
++#ifndef __LP64__
+ static PyObject *FInfo_New(FInfo *itself);
+-static PyObject *FSRef_New(FSRef *itself);
+ static PyObject *FSSpec_New(FSSpec *itself);
++#define FSSpec_Convert PyMac_GetFSSpec
++#endif /* !__LP64__ */
++static PyObject *FSRef_New(FSRef *itself);
+ static PyObject *Alias_New(AliasHandle itself);
++#ifndef __LP64__
+ static int FInfo_Convert(PyObject *v, FInfo *p_itself);
++#endif /* !__LP64__ */
+ #define FSRef_Convert PyMac_GetFSRef
+-#define FSSpec_Convert PyMac_GetFSSpec
+ static int Alias_Convert(PyObject *v, AliasHandle *p_itself);
+
+ /*
+@@ -62,6 +70,7 @@
+ /*
+ ** Optional fsspec and fsref pointers. None will pass NULL
+ */
++#ifndef __LP64__
+ static int
+ myPyMac_GetOptFSSpecPtr(PyObject *v, FSSpec **spec)
+ {
+@@ -71,6 +80,7 @@
+ }
+ return PyMac_GetFSSpec(v, *spec);
+ }
++#endif /* !__LP64__ */
+
+ static int
+ myPyMac_GetOptFSRefPtr(PyObject *v, FSRef **ref)
+@@ -92,6 +102,7 @@
+ return Py_BuildValue("u#", itself->unicode, itself->length);
+ }
+
++#ifndef __LP64__
+ static OSErr
+ _PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
+ {
+@@ -135,6 +146,7 @@
+ }
+ return 0;
+ }
++#endif /* !__LP64__ */
+
+
+ static PyObject *File_Error;
+@@ -282,12 +294,28 @@
+
+ static PyObject *FSCatalogInfo_get_permissions(FSCatalogInfoObject *self, void *closure)
+ {
+- return Py_BuildValue("(llll)", self->ob_itself.permissions[0], self->ob_itself.permissions[1], self->ob_itself.permissions[2], self->ob_itself.permissions[3]);
++ FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions);
++ return Py_BuildValue("(llll)", info->userID, info->groupID, info->userAccess, info->mode);
+ }
+
+ static int FSCatalogInfo_set_permissions(FSCatalogInfoObject *self, PyObject *v, void *closure)
+ {
+- return PyArg_Parse(v, "(llll)", &self->ob_itself.permissions[0], &self->ob_itself.permissions[1], &self->ob_itself.permissions[2], &self->ob_itself.permissions[3])-1;
++ long userID;
++ long groupID;
++ long userAccess;
++ long mode;
++ int r;
++
++ FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions);
++
++ r = PyArg_Parse(v, "(llll)", &userID, &groupID, &userAccess, &mode);
++ if (!r) {
++ return -1;
++ }
++ info->userID = userID;
++ info->groupID = groupID;
++ info->userAccess = userAccess;
++ info->mode = mode;
+ return 0;
+ }
+
+@@ -501,6 +529,7 @@
+
+ /* ----------------------- Object type FInfo ------------------------ */
+
++#ifndef __LP64__
+ static PyTypeObject FInfo_Type;
+
+ #define FInfo_Check(x) ((x)->ob_type == &FInfo_Type || PyObject_TypeCheck((x), &FInfo_Type))
+@@ -682,6 +711,7 @@
+ FInfo_tp_free, /* tp_free */
+ };
+
++#endif /* !__LP64__ */
+ /* --------------------- End object type FInfo ---------------------- */
+
+
+@@ -729,6 +759,7 @@
+ self->ob_type->tp_free((PyObject *)self);
+ }
+
++#ifndef __LP64__
+ static PyObject *Alias_ResolveAlias(AliasObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+@@ -818,6 +849,7 @@
+ wasChanged);
+ return _res;
+ }
++#endif /* !__LP64__ */
+
+ static PyObject *Alias_FSResolveAliasWithMountFlags(AliasObject *_self, PyObject *_args)
+ {
+@@ -891,6 +923,7 @@
+ }
+
+ static PyMethodDef Alias_methods[] = {
++#ifndef __LP64__
+ {"ResolveAlias", (PyCFunction)Alias_ResolveAlias, 1,
+ PyDoc_STR("(FSSpec fromFile) -> (FSSpec target, Boolean wasChanged)")},
+ {"GetAliasInfo", (PyCFunction)Alias_GetAliasInfo, 1,
+@@ -899,6 +932,7 @@
+ PyDoc_STR("(FSSpec fromFile, unsigned long mountFlags) -> (FSSpec target, Boolean wasChanged)")},
+ {"FollowFinderAlias", (PyCFunction)Alias_FollowFinderAlias, 1,
+ PyDoc_STR("(FSSpec fromFile, Boolean logon) -> (FSSpec target, Boolean wasChanged)")},
++#endif /* !__LP64__ */
+ {"FSResolveAliasWithMountFlags", (PyCFunction)Alias_FSResolveAliasWithMountFlags, 1,
+ PyDoc_STR("(FSRef fromFile, unsigned long mountFlags) -> (FSRef target, Boolean wasChanged)")},
+ {"FSResolveAlias", (PyCFunction)Alias_FSResolveAlias, 1,
+@@ -1033,6 +1067,7 @@
+
+
+ /* ----------------------- Object type FSSpec ----------------------- */
++#ifndef __LP64__
+
+ static PyTypeObject FSSpec_Type;
+
+@@ -1488,6 +1523,7 @@
+ FSSpec_tp_free, /* tp_free */
+ };
+
++#endif /* !__LP64__ */
+ /* --------------------- End object type FSSpec --------------------- */
+
+
+@@ -1568,7 +1604,9 @@
+ FSCatalogInfoBitmap whichInfo;
+ FSCatalogInfo catalogInfo;
+ FSRef newRef;
++#ifndef __LP64__
+ FSSpec newSpec;
++#endif /* !__LP64__ */
+ if (!PyArg_ParseTuple(_args, "u#lO&",
+ &nameLength__in__, &nameLength__in_len__,
+ &whichInfo,
+@@ -1580,11 +1618,20 @@
+ whichInfo,
+ &catalogInfo,
+ &newRef,
+- &newSpec);
++#ifndef __LP64__
++ &newSpec
++#else
++ NULL
++#endif /* !__LP64__ */
++ );
+ if (_err != noErr) return PyMac_Error(_err);
++#ifndef __LP64__
+ _res = Py_BuildValue("O&O&",
+ FSRef_New, &newRef,
+ FSSpec_New, &newSpec);
++#else
++ _res = Py_BuildValue("O&O", FSRef_New, &newRef, Py_None);
++#endif /* !__LP64__ */
+ return _res;
+ }
+
+@@ -1598,7 +1645,9 @@
+ FSCatalogInfoBitmap whichInfo;
+ FSCatalogInfo catalogInfo;
+ FSRef newRef;
++#ifndef __LP64__
+ FSSpec newSpec;
++#endif /* !__LP64__ */
+ UInt32 newDirID;
+ if (!PyArg_ParseTuple(_args, "u#lO&",
+ &nameLength__in__, &nameLength__in_len__,
+@@ -1611,13 +1660,25 @@
+ whichInfo,
+ &catalogInfo,
+ &newRef,
++#ifndef __LP64__
+ &newSpec,
++#else
++ NULL,
++#endif /* !__LP64__ */
+ &newDirID);
+ if (_err != noErr) return PyMac_Error(_err);
++
++#ifndef __LP64__
+ _res = Py_BuildValue("O&O&l",
+ FSRef_New, &newRef,
+ FSSpec_New, &newSpec,
+ newDirID);
++#else
++ _res = Py_BuildValue("O&Ol",
++ FSRef_New, &newRef,
++ Py_None,
++ newDirID);
++#endif /* !__LP64__ */
+ return _res;
+ }
+
+@@ -1699,7 +1760,9 @@
+ FSCatalogInfoBitmap whichInfo;
+ FSCatalogInfo catalogInfo;
+ HFSUniStr255 outName;
++#ifndef __LP64__
+ FSSpec fsSpec;
++#endif /* !__LP64__ */
+ FSRef parentRef;
+ if (!PyArg_ParseTuple(_args, "l",
+ &whichInfo))
+@@ -1708,14 +1771,26 @@
+ whichInfo,
+ &catalogInfo,
+ &outName,
++#ifndef __LP64__
+ &fsSpec,
++#else
++ NULL,
++#endif /* !__LP64__ */
+ &parentRef);
+ if (_err != noErr) return PyMac_Error(_err);
++#ifndef __LP64__
+ _res = Py_BuildValue("O&O&O&O&",
+ FSCatalogInfo_New, &catalogInfo,
+ PyMac_BuildHFSUniStr255, &outName,
+ FSSpec_New, &fsSpec,
+ FSRef_New, &parentRef);
++#else
++ _res = Py_BuildValue("O&O&OO&",
++ FSCatalogInfo_New, &catalogInfo,
++ PyMac_BuildHFSUniStr255, &outName,
++ Py_None,
++ FSRef_New, &parentRef);
++#endif /* !__LP64__ */
+ return _res;
+ }
+
+@@ -1784,7 +1859,7 @@
+ UniCharCount forkNameLength__len__;
+ int forkNameLength__in_len__;
+ SInt8 permissions;
+- SInt16 forkRefNum;
++ FSIORefNum forkRefNum;
+ if (!PyArg_ParseTuple(_args, "u#b",
+ &forkNameLength__in__, &forkNameLength__in_len__,
+ &permissions))
+@@ -2034,7 +2109,7 @@
+
+ /* --------------------- End object type FSRef ---------------------- */
+
+-
++#ifndef __LP64__
+ static PyObject *File_UnmountVol(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+@@ -2562,6 +2637,7 @@
+ FSSpec_New, &spec);
+ return _res;
+ }
++#endif /* !__LP64__ */
+
+ static PyObject *File_FSGetForkPosition(PyObject *_self, PyObject *_args)
+ {
+@@ -2785,6 +2861,7 @@
+ return _res;
+ }
+
++#ifndef __LP64__
+ static PyObject *File_NewAlias(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+@@ -2933,6 +3010,7 @@
+ wasAliased);
+ return _res;
+ }
++#endif /* !__LP64__ */
+
+ static PyObject *File_FSNewAlias(PyObject *_self, PyObject *_args)
+ {
+@@ -3050,6 +3128,7 @@
+ }
+
+ static PyMethodDef File_methods[] = {
++#ifndef __LP64__
+ {"UnmountVol", (PyCFunction)File_UnmountVol, 1,
+ PyDoc_STR("(Str63 volName, short vRefNum) -> None")},
+ {"FlushVol", (PyCFunction)File_FlushVol, 1,
+@@ -3100,6 +3179,7 @@
+ PyDoc_STR("(short vRefNum, long dirID, Str255 oldName, long newDirID, Str255 newName) -> None")},
+ {"FSMakeFSSpec", (PyCFunction)File_FSMakeFSSpec, 1,
+ PyDoc_STR("(short vRefNum, long dirID, Str255 fileName) -> (FSSpec spec)")},
++#endif /* !__LP64__ */
+ {"FSGetForkPosition", (PyCFunction)File_FSGetForkPosition, 1,
+ PyDoc_STR("(SInt16 forkRefNum) -> (SInt64 position)")},
+ {"FSSetForkPosition", (PyCFunction)File_FSSetForkPosition, 1,
+@@ -3124,6 +3204,7 @@
+ PyDoc_STR("(UInt8 * path, FNMessage message, OptionBits flags) -> None")},
+ {"FNNotifyAll", (PyCFunction)File_FNNotifyAll, 1,
+ PyDoc_STR("(FNMessage message, OptionBits flags) -> None")},
++#ifndef __LP64__
+ {"NewAlias", (PyCFunction)File_NewAlias, 1,
+ PyDoc_STR("(FSSpec fromFile, FSSpec target) -> (AliasHandle alias)")},
+ {"NewAliasMinimalFromFullPath", (PyCFunction)File_NewAliasMinimalFromFullPath, 1,
+@@ -3136,6 +3217,7 @@
+ PyDoc_STR("(FSSpec fromFile, FSSpec target, AliasHandle alias) -> (Boolean wasChanged)")},
+ {"ResolveAliasFileWithMountFlagsNoUI", (PyCFunction)File_ResolveAliasFileWithMountFlagsNoUI, 1,
+ PyDoc_STR("(FSSpec theSpec, Boolean resolveAliasChains, unsigned long mountFlags) -> (FSSpec theSpec, Boolean targetIsFolder, Boolean wasAliased)")},
++#endif /* !__LP64__ */
+ {"FSNewAlias", (PyCFunction)File_FSNewAlias, 1,
+ PyDoc_STR("(FSRef fromFile, FSRef target) -> (AliasHandle inAlias)")},
+ {"FSResolveAliasFileWithMountFlags", (PyCFunction)File_FSResolveAliasFileWithMountFlags, 1,
+@@ -3150,7 +3232,7 @@
+ };
+
+
+-
++#ifndef __LP64__
+ int
+ PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
+ {
+@@ -3188,12 +3270,15 @@
+ }
+ return 0;
+ }
++#endif /* !__LP64__ */
+
+ int
+ PyMac_GetFSRef(PyObject *v, FSRef *fsr)
+ {
+ OSStatus err;
++#ifndef __LP64__
+ FSSpec fss;
++#endif /* !__LP64__ */
+
+ if (FSRef_Check(v)) {
+ *fsr = ((FSRefObject *)v)->ob_itself;
+@@ -3211,6 +3296,7 @@
+ return !err;
+ }
+ /* XXXX Should try unicode here too */
++#ifndef __LP64__
+ /* Otherwise we try to go via an FSSpec */
+ if (FSSpec_Check(v)) {
+ fss = ((FSSpecObject *)v)->ob_itself;
+@@ -3219,15 +3305,18 @@
+ PyMac_Error(err);
+ return 0;
+ }
++#endif /* !__LP64__ */
+ PyErr_SetString(PyExc_TypeError, "FSRef, FSSpec or pathname required");
+ return 0;
+ }
+
++#ifndef __LP64__
+ extern PyObject *
+ PyMac_BuildFSSpec(FSSpec *spec)
+ {
+ return FSSpec_New(spec);
+ }
++#endif /* !__LP64__ */
+
+ extern PyObject *
+ PyMac_BuildFSRef(FSRef *spec)
+@@ -3242,10 +3331,11 @@
+ PyObject *d;
+
+
+-
++#ifndef __LP64__
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(FSSpec *, PyMac_BuildFSSpec);
+- PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSSpec, PyMac_GetFSSpec);
++#endif /* !__LP64__ */
++ PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSRef, PyMac_GetFSRef);
+
+
+@@ -3262,6 +3352,7 @@
+ /* Backward-compatible name */
+ Py_INCREF(&FSCatalogInfo_Type);
+ PyModule_AddObject(m, "FSCatalogInfoType", (PyObject *)&FSCatalogInfo_Type);
++#ifndef __LP64__
+ FInfo_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&FInfo_Type) < 0) return;
+ Py_INCREF(&FInfo_Type);
+@@ -3269,6 +3360,7 @@
+ /* Backward-compatible name */
+ Py_INCREF(&FInfo_Type);
+ PyModule_AddObject(m, "FInfoType", (PyObject *)&FInfo_Type);
++#endif /* !__LP64__ */
+ Alias_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&Alias_Type) < 0) return;
+ Py_INCREF(&Alias_Type);
+@@ -3276,6 +3368,7 @@
+ /* Backward-compatible name */
+ Py_INCREF(&Alias_Type);
+ PyModule_AddObject(m, "AliasType", (PyObject *)&Alias_Type);
++#ifndef __LP64__
+ FSSpec_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&FSSpec_Type) < 0) return;
+ Py_INCREF(&FSSpec_Type);
+@@ -3283,6 +3376,7 @@
+ /* Backward-compatible name */
+ Py_INCREF(&FSSpec_Type);
+ PyModule_AddObject(m, "FSSpecType", (PyObject *)&FSSpec_Type);
++#endif /* !__LP64__ */
+ FSRef_Type.ob_type = &PyType_Type;
+ if (PyType_Ready(&FSRef_Type) < 0) return;
+ Py_INCREF(&FSRef_Type);
+Index: Lib/plat-mac/macresource.py
+===================================================================
+--- Lib/plat-mac/macresource.py (revision 74680)
++++ Lib/plat-mac/macresource.py (revision 74681)
+@@ -79,8 +79,8 @@
+ AppleSingle file"""
+ try:
+ refno = Res.FSpOpenResFile(pathname, 1)
+- except Res.Error, arg:
+- if arg[0] in (-37, -39):
++ except (AttributeError, Res.Error), arg:
++ if isinstance(arg, AttributeError) or arg[0] in (-37, -39):
+ # No resource fork. We may be on OSX, and this may be either
+ # a data-fork based resource file or a AppleSingle file
+ # from the CVS repository.
+@@ -106,8 +106,8 @@
+ try:
+ refno = Res.FSpOpenResFile(pathname, 1)
+ Res.CloseResFile(refno)
+- except Res.Error, arg:
+- if arg[0] in (-37, -39):
++ except (AttributeError, Res.Error), arg:
++ if isinstance(arg, AttributeError) or arg[0] in (-37, -39):
+ # No resource fork. We may be on OSX, and this may be either
+ # a data-fork based resource file or a AppleSingle file
+ # from the CVS repository.
+Index: Lib/plat-mac/applesingle.py
+===================================================================
+--- Lib/plat-mac/applesingle.py (revision 74680)
++++ Lib/plat-mac/applesingle.py (revision 74681)
+@@ -119,8 +119,13 @@
+ if not hasattr(infile, 'read'):
+ if isinstance(infile, Carbon.File.Alias):
+ infile = infile.ResolveAlias()[0]
+- if isinstance(infile, (Carbon.File.FSSpec, Carbon.File.FSRef)):
+- infile = infile.as_pathname()
++
++ if hasattr(Carbon.File, "FSSpec"):
++ if isinstance(infile, (Carbon.File.FSSpec, Carbon.File.FSRef)):
++ infile = infile.as_pathname()
++ else:
++ if isinstance(infile, Carbon.File.FSRef):
++ infile = infile.as_pathname()
+ infile = open(infile, 'rb')
+
+ asfile = AppleSingle(infile, verbose=verbose)
+Index: Mac/scripts/BuildApplet.py
+===================================================================
+--- Mac/scripts/BuildApplet.py (revision 74680)
++++ Mac/scripts/BuildApplet.py (revision 74681)
+@@ -12,7 +12,10 @@
+
+ import os
+ import MacOS
+-import EasyDialogs
++try:
++ import EasyDialogs
++except ImportError:
++ EasyDialogs = None
+ import buildtools
+ import getopt
+
+@@ -32,7 +35,10 @@
+ try:
+ buildapplet()
+ except buildtools.BuildError, detail:
+- EasyDialogs.Message(detail)
++ if EasyDialogs is None:
++ print detail
++ else:
++ EasyDialogs.Message(detail)
+
+
+ def buildapplet():
+@@ -46,6 +52,10 @@
+ # Ask for source text if not specified in sys.argv[1:]
+
+ if not sys.argv[1:]:
++ if EasyDialogs is None:
++ usage()
++ sys.exit(1)
++
+ filename = EasyDialogs.AskFileForOpen(message='Select Python source or applet:',
+ typeList=('TEXT', 'APPL'))
+ if not filename:
+Index: Lib/plat-mac/buildtools.py
+===================================================================
+--- Lib/plat-mac/buildtools.py (revision 74680)
++++ Lib/plat-mac/buildtools.py (revision 74681)
+@@ -15,7 +15,10 @@
+ import MacOS
+ import macostools
+ import macresource
+-import EasyDialogs
++try:
++ import EasyDialogs
++except ImportError:
++ EasyDialogs = None
+ import shutil
+
+
+@@ -67,9 +70,13 @@
+ rsrcname=None, others=[], raw=0, progress="default", destroot=""):
+
+ if progress == "default":
+- progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120)
+- progress.label("Compiling...")
+- progress.inc(0)
++ if EasyDialogs is None:
++ print "Compiling %s"%(os.path.split(filename)[1],)
++ process = None
++ else:
++ progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120)
++ progress.label("Compiling...")
++ progress.inc(0)
+ # check for the script name being longer than 32 chars. This may trigger a bug
+ # on OSX that can destroy your sourcefile.
+ if '#' in os.path.split(filename)[1]:
+@@ -119,7 +126,11 @@
+ if MacOS.runtimemodel == 'macho':
+ raise BuildError, "No updating yet for MachO applets"
+ if progress:
+- progress = EasyDialogs.ProgressBar("Updating %s..."%os.path.split(filename)[1], 120)
++ if EasyDialogs is None:
++ print "Updating %s"%(os.path.split(filename)[1],)
++ progress = None
++ else:
++ progress = EasyDialogs.ProgressBar("Updating %s..."%os.path.split(filename)[1], 120)
+ else:
+ progress = None
+ if not output:
diff --git a/packaging/macosx/ports/lang/python25/files/patch-FSIORefNum.diff b/packaging/macosx/ports/lang/python25/files/patch-FSIORefNum.diff
new file mode 100644
index 000000000..6f8ac6608
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-FSIORefNum.diff
@@ -0,0 +1,11 @@
+--- Mac/Modules/file/_Filemodule.c.orig 2009-09-12 15:55:59.000000000 +1000
++++ Mac/Modules/file/_Filemodule.c 2009-09-12 16:12:07.000000000 +1000
+@@ -7,6 +7,8 @@
+
+ #include "pymactoolbox.h"
+
++typedef SInt16 FSIORefNum;
++
+ /* Macro to test whether a weak-loaded CFM function exists */
+ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
+ PyErr_SetString(PyExc_NotImplementedError, \
diff --git a/packaging/macosx/ports/lang/python25/files/patch-Lib-cgi.py.diff b/packaging/macosx/ports/lang/python25/files/patch-Lib-cgi.py.diff
new file mode 100644
index 000000000..8153bebbd
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-Lib-cgi.py.diff
@@ -0,0 +1,18 @@
+--- Lib/cgi.py.orig 2006-08-10 19:41:07.000000000 +0200
++++ Lib/cgi.py 2007-08-21 15:36:54.000000000 +0200
+@@ -1,13 +1,6 @@
+-#! /usr/local/bin/python
++#! __PREFIX__/bin/python2.5
+
+-# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
+-# intentionally NOT "/usr/bin/env python". On many systems
+-# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
+-# scripts, and /usr/local/bin is the default directory where Python is
+-# installed, so /usr/bin/env would be unable to find python. Granted,
+-# binary installations by Linux vendors often install Python in
+-# /usr/bin. So let those vendors patch cgi.py to match their choice
+-# of installation.
++# NOTE: The original #!/usr/local/bin/python patched for MacPorts installation
+
+ """Support module for CGI (Common Gateway Interface) scripts.
+
diff --git a/packaging/macosx/ports/lang/python25/files/patch-Lib-distutils-dist.py.diff b/packaging/macosx/ports/lang/python25/files/patch-Lib-distutils-dist.py.diff
new file mode 100644
index 000000000..961a8ad28
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-Lib-distutils-dist.py.diff
@@ -0,0 +1,51 @@
+--- Lib/distutils/dist.py.orig 2005-03-23 11:54:36.000000000 -0700
++++ Lib/distutils/dist.py 2008-07-25 21:27:15.000000000 -0600
+@@ -57,6 +57,7 @@
+ ('quiet', 'q', "run quietly (turns verbosity off)"),
+ ('dry-run', 'n', "don't actually do anything"),
+ ('help', 'h', "show detailed help message"),
++ ('no-user-cfg', None,'ignore pydistutils.cfg in your home directory'),
+ ]
+
+ # 'common_usage' is a short (2-3 line) string describing the common
+@@ -264,6 +265,12 @@
+ else:
+ sys.stderr.write(msg + "\n")
+
++ # no-user-cfg is handled before other command line args
++ # because other args override the config files, and this
++ # one is needed before we can load the config files.
++ # If attrs['script_args'] wasn't passed, assume false.
++ self.want_user_cfg = '--no-user-cfg' not in (self.script_args or [])
++
+ self.finalize_options()
+
+ # __init__ ()
+@@ -324,6 +331,9 @@
+ Distutils __inst__.py file lives), a file in the user's home
+ directory named .pydistutils.cfg on Unix and pydistutils.cfg
+ on Windows/Mac, and setup.cfg in the current directory.
++
++ The file in the user's home directory can be disabled with the
++ --no-user-cfg option.
+ """
+ files = []
+ check_environ()
+@@ -343,7 +353,7 @@
+ user_filename = "pydistutils.cfg"
+
+ # And look for the user config file
+- if os.environ.has_key('HOME'):
++ if self.want_user_cfg and os.environ.has_key('HOME'):
+ user_file = os.path.join(os.environ.get('HOME'), user_filename)
+ if os.path.isfile(user_file):
+ files.append(user_file)
+@@ -353,6 +363,8 @@
+ if os.path.isfile(local_file):
+ files.append(local_file)
+
++ if DEBUG:
++ print "using config files: %s" % ', '.join(files)
+ return files
+
+ # find_config_files ()
diff --git a/packaging/macosx/ports/lang/python25/files/patch-Makefile.pre.in.diff b/packaging/macosx/ports/lang/python25/files/patch-Makefile.pre.in.diff
new file mode 100644
index 000000000..e99a24741
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-Makefile.pre.in.diff
@@ -0,0 +1,49 @@
+--- Makefile.pre.in.orig 2008-09-22 10:22:44.000000000 +1000
++++ Makefile.pre.in 2011-10-27 06:47:17.000000000 +1100
+@@ -348,8 +348,8 @@
+ # Build the shared modules
+ sharedmods: $(BUILDPYTHON)
+ case $$MAKEFLAGS in \
+- *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
+- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
++ *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q --no-user-cfg build;; \
++ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py --no-user-cfg build;; \
+ esac
+
+ # Build static library
+@@ -387,7 +387,7 @@
+ $(RESSRCDIR)/English.lproj/InfoPlist.strings
+ $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
+ if test "${UNIVERSALSDK}"; then \
+- $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
++ $(CC) -o $(LDLIBRARY) __UNIVERSAL_LDFLAGS__ -dynamiclib \
+ -isysroot "${UNIVERSALSDK}" \
+ -all_load $(LIBRARY) -Wl,-single_module \
+ -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
+@@ -458,7 +458,7 @@
+ $(SIGNAL_OBJS) \
+ $(MODOBJS) \
+ $(srcdir)/Modules/getbuildinfo.c
+- $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
++ $(CC) -c $(PY_CFLAGS) -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" -o $@ $(srcdir)/Modules/getbuildinfo.c
+
+ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
+ $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
+@@ -894,7 +894,7 @@
+ # Install the dynamically loadable modules
+ # This goes into $(exec_prefix)
+ sharedinstall:
+- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
++ $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py --no-user-cfg install \
+ --prefix=$(prefix) \
+ --install-scripts=$(BINDIR) \
+ --install-platlib=$(DESTSHARED) \
+@@ -968,7 +968,7 @@
+ # This installs a few of the useful scripts in Tools/scripts
+ scriptsinstall:
+ SRCDIR=$(srcdir) $(RUNSHARED) \
+- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
++ ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py --no-user-cfg install \
+ --prefix=$(prefix) \
+ --install-scripts=$(BINDIR) \
+ --root=/$(DESTDIR)
diff --git a/packaging/macosx/ports/lang/python25/files/patch-Misc-setuid-prog.c.diff b/packaging/macosx/ports/lang/python25/files/patch-Misc-setuid-prog.c.diff
new file mode 100644
index 000000000..0fee9e791
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-Misc-setuid-prog.c.diff
@@ -0,0 +1,16 @@
+--- Misc/setuid-prog.c.orig Sat Dec 11 14:29:22 2004
++++ Misc/setuid-prog.c Sat Dec 11 14:30:13 2004
+@@ -70,6 +70,12 @@
+ #define environ _environ
+ #endif
+
++#if defined(__APPLE__)
++#include <sys/time.h>
++#include <crt_externs.h>
++#define environ (*_NSGetEnviron())
++#endif
++
+ /* don't change def_IFS */
+ char def_IFS[] = "IFS= \t\n";
+ /* you may want to change def_PATH, but you should really change it in */
+
diff --git a/packaging/macosx/ports/lang/python25/files/patch-Modules-posixmodule.c.diff b/packaging/macosx/ports/lang/python25/files/patch-Modules-posixmodule.c.diff
new file mode 100644
index 000000000..c14913cf7
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-Modules-posixmodule.c.diff
@@ -0,0 +1,21 @@
+--- Modules/posixmodule.c.orig Sat Dec 11 14:27:52 2004
++++ Modules/posixmodule.c Sat Dec 11 14:28:17 2004
+@@ -339,7 +339,7 @@
+ #endif
+
+ /* Return a dictionary corresponding to the POSIX environment table */
+-#ifdef WITH_NEXT_FRAMEWORK
++#ifdef __APPLE__
+ /* On Darwin/MacOSX a shared library or framework has no access to
+ ** environ directly, we must obtain it with _NSGetEnviron().
+ */
+@@ -357,7 +357,7 @@
+ d = PyDict_New();
+ if (d == NULL)
+ return NULL;
+-#ifdef WITH_NEXT_FRAMEWORK
++#ifdef __APPLE__
+ if (environ == NULL)
+ environ = *_NSGetEnviron();
+ #endif
+
diff --git a/packaging/macosx/ports/lang/python25/files/patch-configure.diff b/packaging/macosx/ports/lang/python25/files/patch-configure.diff
new file mode 100644
index 000000000..22d260047
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-configure.diff
@@ -0,0 +1,45 @@
+--- configure.orig 2008-12-14 01:13:52.000000000 +1100
++++ configure 2011-05-10 16:25:02.000000000 +1000
+@@ -4534,9 +4534,11 @@
+ ;;
+ # is there any other compiler on Darwin besides gcc?
+ Darwin*)
+- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
++ BASECFLAGS="$BASECFLAGS -mno-fused-madd"
+ if test "${enable_universalsdk}"; then
+- BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
++ BASECFLAGS="__UNIVERSAL_CFLAGS__ -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
++ else
++ BASECFLAGS="-arch __BUILD_ARCH__ ${BASECFLAGS}"
+ fi
+
+ ;;
+@@ -11362,7 +11364,7 @@
+ if test "${enable_universalsdk}"; then
+ :
+ else
+- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
++ LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only __BUILD_ARCH__"
+ fi
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
+@@ -11374,7 +11376,7 @@
+ else
+ LIBTOOL_CRUFT=""
+ fi
+- LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
++ LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only __BUILD_ARCH__"
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
+ esac
+@@ -11524,7 +11526,9 @@
+ if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
+ then
+ if test "${enable_universalsdk}"; then
+- LDFLAGS="-arch i386 -arch ppc -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
++ LDFLAGS="__UNIVERSAL_LDFLAGS__ -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
++ else
++ LDFLAGS="-arch __BUILD_ARCH__ ${LDFLAGS}"
+ fi
+ LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
+ BLDSHARED="$LDSHARED"
diff --git a/packaging/macosx/ports/lang/python25/files/patch-fwrapv.diff b/packaging/macosx/ports/lang/python25/files/patch-fwrapv.diff
new file mode 100644
index 000000000..130a3ad5d
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-fwrapv.diff
@@ -0,0 +1,12 @@
+--- configure.orig 2011-11-22 09:08:58.000000000 +1100
++++ configure 2011-11-22 09:10:56.000000000 +1100
+@@ -4428,9 +4428,7 @@
+ STRICT_PROTO="-Wstrict-prototypes"
+ fi
+ # For gcc 4.x we need to use -fwrapv so lets check if its supported
+- if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
+ WRAP="-fwrapv"
+- fi
+ case $ac_cv_prog_cc_g in
+ yes)
+ if test "$Py_DEBUG" = 'true' ; then
diff --git a/packaging/macosx/ports/lang/python25/files/patch-libedit.diff b/packaging/macosx/ports/lang/python25/files/patch-libedit.diff
new file mode 100644
index 000000000..99da7a9c4
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-libedit.diff
@@ -0,0 +1,132 @@
+--- configure.orig 2011-10-31 13:23:35.000000000 +1100
++++ configure 2011-10-31 13:28:19.000000000 +1100
+@@ -20985,9 +20985,9 @@
+ echo $ECHO_N "checking how to link readline libs... $ECHO_C" >&6; }
+ for py_libtermcap in "" ncursesw ncurses curses termcap; do
+ if test -z "$py_libtermcap"; then
+- READLINE_LIBS="-lreadline"
++ READLINE_LIBS="-ledit"
+ else
+- READLINE_LIBS="-lreadline -l$py_libtermcap"
++ READLINE_LIBS="-ledit -l$py_libtermcap"
+ fi
+ LIBS="$READLINE_LIBS $LIBS_no_readline"
+ cat >conftest.$ac_ext <<_ACEOF
+@@ -21060,13 +21060,13 @@
+ fi
+
+ # check for readline 2.1
+-{ echo "$as_me:$LINENO: checking for rl_callback_handler_install in -lreadline" >&5
+-echo $ECHO_N "checking for rl_callback_handler_install in -lreadline... $ECHO_C" >&6; }
++{ echo "$as_me:$LINENO: checking for rl_callback_handler_install in -ledit" >&5
++echo $ECHO_N "checking for rl_callback_handler_install in -ledit... $ECHO_C" >&6; }
+ if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lreadline $READLINE_LIBS $LIBS"
++LIBS="-ledit $READLINE_LIBS $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+ _ACEOF
+@@ -21137,7 +21137,7 @@
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h. */
+-#include <readline/readline.h>
++#include <editline/readline.h>
+ _ACEOF
+ if { (ac_try="$ac_cpp conftest.$ac_ext"
+ case "(($ac_try" in
+@@ -21172,7 +21172,7 @@
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h. */
+-#include <readline/readline.h>
++#include <editline/readline.h>
+
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+@@ -21188,13 +21188,13 @@
+ fi
+
+ # check for readline 4.0
+-{ echo "$as_me:$LINENO: checking for rl_pre_input_hook in -lreadline" >&5
+-echo $ECHO_N "checking for rl_pre_input_hook in -lreadline... $ECHO_C" >&6; }
++{ echo "$as_me:$LINENO: checking for rl_pre_input_hook in -ledit" >&5
++echo $ECHO_N "checking for rl_pre_input_hook in -ledit... $ECHO_C" >&6; }
+ if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lreadline $READLINE_LIBS $LIBS"
++LIBS="-ledit $READLINE_LIBS $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+ _ACEOF
+@@ -21259,13 +21259,13 @@
+
+
+ # check for readline 4.2
+-{ echo "$as_me:$LINENO: checking for rl_completion_matches in -lreadline" >&5
+-echo $ECHO_N "checking for rl_completion_matches in -lreadline... $ECHO_C" >&6; }
++{ echo "$as_me:$LINENO: checking for rl_completion_matches in -ledit" >&5
++echo $ECHO_N "checking for rl_completion_matches in -ledit... $ECHO_C" >&6; }
+ if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lreadline $READLINE_LIBS $LIBS"
++LIBS="-ledit $READLINE_LIBS $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+ _ACEOF
+@@ -21336,7 +21336,7 @@
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h. */
+-#include <readline/readline.h>
++#include <editline/readline.h>
+ _ACEOF
+ if { (ac_try="$ac_cpp conftest.$ac_ext"
+ case "(($ac_try" in
+@@ -21371,7 +21371,7 @@
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h. */
+-#include <readline/readline.h>
++#include <editline/readline.h>
+
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+--- setup.py.orig 2011-10-31 13:23:35.000000000 +1100
++++ setup.py 2011-10-31 13:32:40.000000000 +1100
+@@ -488,7 +488,7 @@
+ else:
+ readline_extra_link_args = ()
+
+- readline_libs = ['readline']
++ readline_libs = ['edit']
+ if self.compiler.find_library_file(lib_dirs,
+ 'ncursesw'):
+ readline_libs.append('ncursesw')
+--- Modules/readline.c.orig 2007-01-23 03:10:27.000000000 +1100
++++ Modules/readline.c 2011-10-31 14:00:36.000000000 +1100
+@@ -28,8 +28,7 @@
+
+ /* GNU readline definitions */
+ #undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */
+-#include <readline/readline.h>
+-#include <readline/history.h>
++#include <editline/readline.h>
+
+ #ifdef HAVE_RL_COMPLETION_MATCHES
+ #define completion_matches(x, y) \
+@@ -794,7 +793,6 @@ readline_until_enter_or_signal(char *pro
+ PyEval_SaveThread();
+ #endif
+ if (s < 0) {
+- rl_free_line_state();
+ rl_cleanup_after_signal();
+ rl_callback_handler_remove();
+ *signal = 1;
diff --git a/packaging/macosx/ports/lang/python25/files/patch-mac_ver.diff b/packaging/macosx/ports/lang/python25/files/patch-mac_ver.diff
new file mode 100644
index 000000000..5350dee29
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-mac_ver.diff
@@ -0,0 +1,114 @@
+
+# HG changeset patch
+# User Ronald Oussoren <ronaldoussoren@mac.com>
+# Date 1279889153 0
+# Node ID e267ee9760bd14a8b4270e12af982c941fa7a67d
+# Parent bdc069a1a721b28ad21849232bd5426dda871506
+Merged revisions 83085 via svnmerge from
+svn+ssh://pythondev@svn.python.org/python/branches/release27-maint
+
+................
+ r83085 | ronald.oussoren | 2010-07-23 13:41:00 +0100 (Fri, 23 Jul 2010) | 12 lines
+
+ Merged revisions 83075 via svnmerge from
+ svn+ssh://pythondev@svn.python.org/python/branches/py3k
+
+ ........
+ r83075 | ronald.oussoren | 2010-07-23 12:54:59 +0100 (Fri, 23 Jul 2010) | 5 lines
+
+ Fix for issue 7895. Avoid crashing the interpreter
+ when calling platform.mac_ver after calling os.fork by
+ reading from a system configuration file instead of
+ using OSX APIs.
+ ........
+................
+
+diff --git a/Lib/platform.py b/Lib/platform.py
+--- Lib/platform.py
++++ Lib/platform.py
+@@ -562,28 +562,20 @@ def _bcd2str(bcd):
+
+ return hex(bcd)[2:]
+
+-def mac_ver(release='',versioninfo=('','',''),machine=''):
+-
+- """ Get MacOS version information and return it as tuple (release,
+- versioninfo, machine) with versioninfo being a tuple (version,
+- dev_stage, non_release_version).
+-
+- Entries which cannot be determined are set to the paramter values
+- which default to ''. All tuple entries are strings.
+-
++def _mac_ver_gestalt():
++ """
+ Thanks to Mark R. Levinson for mailing documentation links and
+ code examples for this function. Documentation for the
+ gestalt() API is available online at:
+
+ http://www.rgaros.nl/gestalt/
+-
+ """
+ # Check whether the version info module is available
+ try:
+ import gestalt
+ import MacOS
+ except ImportError:
+- return release,versioninfo,machine
++ return None
+ # Get the infos
+ sysv,sysu,sysa = _mac_ver_lookup(('sysv','sysu','sysa'))
+ # Decode the infos
+@@ -619,6 +611,53 @@ def mac_ver(release='',versioninfo=('','
+ machine = {0x1: '68k',
+ 0x2: 'PowerPC',
+ 0xa: 'i386'}.get(sysa,'')
++
++ return release,versioninfo,machine
++
++def _mac_ver_xml():
++ fn = '/System/Library/CoreServices/SystemVersion.plist'
++ if not os.path.exists(fn):
++ return None
++
++ try:
++ import plistlib
++ except ImportError:
++ return None
++
++ pl = plistlib.readPlist(fn)
++ release = pl['ProductVersion']
++ versioninfo=('', '', '')
++ machine = os.uname()[4]
++ if machine == 'ppc':
++ # for compatibility with the gestalt based code
++ machine = 'PowerPC'
++
++ return release,versioninfo,machine
++
++
++def mac_ver(release='',versioninfo=('','',''),machine=''):
++
++ """ Get MacOS version information and return it as tuple (release,
++ versioninfo, machine) with versioninfo being a tuple (version,
++ dev_stage, non_release_version).
++
++ Entries which cannot be determined are set to the paramter values
++ which default to ''. All tuple entries are strings.
++ """
++
++ # First try reading the information from an XML file which should
++ # always be present
++ info = _mac_ver_xml()
++ if info is not None:
++ return info
++
++ # If that doesn't work for some reason fall back to reading the
++ # information using gestalt calls.
++ info = _mac_ver_gestalt()
++ if info is not None:
++ return info
++
++ # If that also doesn't work return the default values
+ return release,versioninfo,machine
+
+ def _java_getprop(name,default):
diff --git a/packaging/macosx/ports/lang/python25/files/patch-pyconfig.h.in.diff b/packaging/macosx/ports/lang/python25/files/patch-pyconfig.h.in.diff
new file mode 100644
index 000000000..bd0ecd803
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-pyconfig.h.in.diff
@@ -0,0 +1,13 @@
+--- pyconfig.h.in.orig 2009-08-16 10:22:50.000000000 -0700
++++ pyconfig.h.in 2009-08-16 10:23:24.000000000 -0700
+@@ -4,6 +4,10 @@
+ #ifndef Py_PYCONFIG_H
+ #define Py_PYCONFIG_H
+
++// Required on Darwin 10+
++#ifndef _DARWIN_C_SOURCE
++#define _DARWIN_C_SOURCE
++#endif
+
+ /* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want
+ support for AIX C++ shared extension modules. */
diff --git a/packaging/macosx/ports/lang/python25/files/patch-setup.py-disabled_modules.diff b/packaging/macosx/ports/lang/python25/files/patch-setup.py-disabled_modules.diff
new file mode 100644
index 000000000..14d3bc582
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-setup.py-disabled_modules.diff
@@ -0,0 +1,11 @@
+--- setup.py.orig 2009-03-31 12:20:48.000000000 -0600
++++ setup.py 2009-09-17 00:33:12.000000000 -0600
+@@ -17,7 +17,7 @@
+ from distutils.command.install_lib import install_lib
+
+ # This global variable is used to hold the list of modules to be disabled.
+-disabled_module_list = []
++disabled_module_list = ["_tkinter", "gdbm"]
+
+ def add_dir_to_list(dirlist, dir):
+ """Add the directory 'dir' to the list 'dirlist' (at the front) if
diff --git a/packaging/macosx/ports/lang/python25/files/patch-setup.py.diff b/packaging/macosx/ports/lang/python25/files/patch-setup.py.diff
new file mode 100644
index 000000000..2649594c8
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/patch-setup.py.diff
@@ -0,0 +1,80 @@
+--- setup.py.orig 2008-10-16 12:58:19.000000000 -0600
++++ setup.py 2009-06-07 20:55:17.000000000 -0600
+@@ -609,7 +609,7 @@
+ # a release. Most open source OSes come with one or more
+ # versions of BerkeleyDB already installed.
+
+- max_db_ver = (4, 5)
++ max_db_ver = (4, 6)
+ # NOTE: while the _bsddb.c code links against BerkeleyDB 4.6.x
+ # we leave that version disabled by default as it has proven to be
+ # quite a buggy library release on many platforms.
+@@ -636,6 +636,7 @@
+ db_inc_paths.append('/usr/local/include/db4%d' % x)
+ db_inc_paths.append('/pkg/db-4.%d/include' % x)
+ db_inc_paths.append('/opt/db-4.%d/include' % x)
++ db_inc_paths.append('__PREFIX__/include/db4%d' % x)
+ # 3.x minor number specific paths
+ for x in (3,):
+ db_inc_paths.append('/usr/include/db3%d' % x)
+@@ -711,6 +712,7 @@
+
+ # check lib directories parallel to the location of the header
+ db_dirs_to_check = [
++ os.path.join('__PREFIX__', 'lib', 'db46'),
+ os.path.join(db_incdir, '..', 'lib64'),
+ os.path.join(db_incdir, '..', 'lib'),
+ os.path.join(db_incdir, '..', '..', 'lib64'),
+@@ -1212,13 +1214,7 @@
+ def detect_tkinter(self, inc_dirs, lib_dirs):
+ # The _tkinter module.
+
+- # Rather than complicate the code below, detecting and building
+- # AquaTk is a separate method. Only one Tkinter will be built on
+- # Darwin - either AquaTk, if it is found, or X11 based Tk.
+ platform = self.get_platform()
+- if (platform == 'darwin' and
+- self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
+- return
+
+ # Assume we haven't found any of the libraries or include files
+ # The versions with dots are used on Unix, and the versions without
+--- setup.py.orig 2009-09-10 19:41:32.000000000 +1000
++++ setup.py 2009-09-10 19:48:30.000000000 +1000
+@@ -1197,7 +1197,7 @@
+ # For 8.4a2, the X11 headers are not included. Rather than include a
+ # complicated search, this is a hard-coded path. It could bail out
+ # if X11 libs are not found...
+- include_dirs.append('/usr/X11R6/include')
++ #include_dirs.append('/usr/X11R6/include')
+ frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
+
+ ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
+@@ -1262,17 +1262,17 @@
+ if platform == 'sunos5':
+ include_dirs.append('/usr/openwin/include')
+ added_lib_dirs.append('/usr/openwin/lib')
+- elif os.path.exists('/usr/X11R6/include'):
+- include_dirs.append('/usr/X11R6/include')
+- added_lib_dirs.append('/usr/X11R6/lib64')
+- added_lib_dirs.append('/usr/X11R6/lib')
+- elif os.path.exists('/usr/X11R5/include'):
+- include_dirs.append('/usr/X11R5/include')
+- added_lib_dirs.append('/usr/X11R5/lib')
+- else:
++ #elif os.path.exists('/usr/X11R6/include'):
++ # include_dirs.append('/usr/X11R6/include')
++ # added_lib_dirs.append('/usr/X11R6/lib64')
++ # added_lib_dirs.append('/usr/X11R6/lib')
++ #elif os.path.exists('/usr/X11R5/include'):
++ # include_dirs.append('/usr/X11R5/include')
++ # added_lib_dirs.append('/usr/X11R5/lib')
++ #else:
+ # Assume default location for X11
+- include_dirs.append('/usr/X11/include')
+- added_lib_dirs.append('/usr/X11/lib')
++ # include_dirs.append('/usr/X11/include')
++ # added_lib_dirs.append('/usr/X11/lib')
+
+ # If Cygwin, then verify that X is installed before proceeding
+ if platform == 'cygwin':
diff --git a/packaging/macosx/ports/lang/python25/files/pyconfig.ed b/packaging/macosx/ports/lang/python25/files/pyconfig.ed
new file mode 100644
index 000000000..671d0d560
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/pyconfig.ed
@@ -0,0 +1,2 @@
+g,.*\(HAVE_POLL[_A-Z]*\).*,s,,/* #undef \1 */,
+w
diff --git a/packaging/macosx/ports/lang/python25/files/pyconfig.h-universal.ed b/packaging/macosx/ports/lang/python25/files/pyconfig.h-universal.ed
new file mode 100644
index 000000000..67ecc11a1
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/pyconfig.h-universal.ed
@@ -0,0 +1,50 @@
+/HAVE_LARGEFILE_SUPPORT/c
+#ifdef __LP64__
+/* #undef HAVE_LARGEFILE_SUPPORT */
+#else
+#define HAVE_LARGEFILE_SUPPORT 1
+#endif
+.
+/SIZEOF_LONG/c
+#ifdef __LP64__
+#define SIZEOF_LONG 8
+#else
+#define SIZEOF_LONG 4
+#endif
+.
+/SIZEOF_PTHREAD_T/c
+#ifdef __LP64__
+#define SIZEOF_PTHREAD_T 8
+#else
+#define SIZEOF_PTHREAD_T 4
+#endif
+.
+/SIZEOF_SIZE_T/c
+#ifdef __LP64__
+#define SIZEOF_SIZE_T 8
+#else
+#define SIZEOF_SIZE_T 4
+#endif
+.
+/SIZEOF_TIME_T/c
+#ifdef __LP64__
+#define SIZEOF_TIME_T 8
+#else
+#define SIZEOF_TIME_T 4
+#endif
+.
+/SIZEOF_UINTPTR_T/c
+#ifdef __LP64__
+#define SIZEOF_UINTPTR_T 8
+#else
+#define SIZEOF_UINTPTR_T 4
+#endif
+.
+/SIZEOF_VOID_P/c
+#ifdef __LP64__
+#define SIZEOF_VOID_P 8
+#else
+#define SIZEOF_VOID_P 4
+#endif
+.
+w
diff --git a/packaging/macosx/ports/lang/python25/files/python25 b/packaging/macosx/ports/lang/python25/files/python25
new file mode 100644
index 000000000..e7ca5aed2
--- /dev/null
+++ b/packaging/macosx/ports/lang/python25/files/python25
@@ -0,0 +1,13 @@
+bin/python2.5
+bin/pythonw2.5
+bin/python2.5-config
+bin/idle2.5
+bin/pydoc2.5
+bin/smtpd2.5.py
+-
+-
+share/man/man1/python2.5.1.gz
+${frameworks_dir}/Python.framework/Versions/2.5
+${frameworks_dir}/Python.framework/Versions/2.5/Headers
+${frameworks_dir}/Python.framework/Versions/2.5/Resources
+${frameworks_dir}/Python.framework/Versions/2.5/Python
diff --git a/packaging/macosx/ports/lang/python26/Portfile b/packaging/macosx/ports/lang/python26/Portfile
new file mode 100644
index 000000000..c72cd28d5
--- /dev/null
+++ b/packaging/macosx/ports/lang/python26/Portfile
@@ -0,0 +1,158 @@
+# $Id: Portfile 49077 2009-04-03 07:13:13Z erickt@macports.org $
+
+PortSystem 1.0
+PortGroup select 1.0
+
+name python26
+version 2.6.1
+revision 100
+set major [lindex [split $version .] 0]
+set branch [join [lrange [split ${version} .] 0 1] .]
+categories lang
+platforms darwin
+maintainers blb mcalhoun
+
+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}/
+
+distname Python-${version}
+use_bzip2 yes
+
+checksums md5 e81c2f0953aa60f8062c05a4673f2be0 \
+ sha1 419f0cb29e9713ea861dde8c43d107c51329e57b \
+ rmd160 497dafaca9c150fca611b0175eeb13c2fc4d3e2d
+
+# patch-Lib-distutils-dist.py.diff comes from
+# <http://bugs.python.org/issue1180>
+patchfiles patch-Makefile.pre.in.diff \
+ patch-setup.py.diff \
+ patch-Lib-cgi.py.diff \
+ patch-Lib-distutils-dist.py.diff \
+ patch-Mac-IDLE-Makefile.in.diff \
+ patch-Mac-Makefile.in.diff \
+ patch-Mac-PythonLauncher-Makefile.in.diff \
+ patch-Mac-Tools-Doc-setup.py.diff
+
+depends_lib port:gettext port:zlib port:openssl port:tk \
+ port:sqlite3 port:db46 port:ncurses port:gdbm \
+ port:bzip2 port:readline
+
+configure.args --enable-framework=${frameworks_dir} \
+ --enable-ipv6
+
+use_parallel_build no
+
+post-patch {
+ reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/Lib/cgi.py
+ reinplace "s|@@APPLICATIONS_DIR@@|${applications_dir}|g" \
+ ${worksrcpath}/Mac/Makefile.in ${worksrcpath}/Mac/IDLE/Makefile.in \
+ ${worksrcpath}/Mac/Tools/Doc/setup.py \
+ ${worksrcpath}/Mac/PythonLauncher/Makefile.in
+
+ # See http://trac.macports.org/changeset/37861
+ reinplace "s|xargs -0 rm -r|/usr/bin/xargs -0 /bin/rm -r|g" \
+ ${worksrcpath}/Mac/PythonLauncher/Makefile.in
+}
+
+build.target all
+
+test.run yes
+test.target test
+
+destroot.target frameworkinstall maninstall
+
+# ensure that correct compiler is used
+build.args-append MAKE="${build.cmd} CC=${configure.cc}"
+destroot.args-append MAKE="${destroot.cmd} CC=${configure.cc}"
+
+select.group python
+select.file ${filespath}/python[string map {. {}} ${branch}]
+
+post-destroot {
+ set framewpath ${frameworks_dir}/Python.framework
+ set framewdir ${framewpath}/Versions/${branch}
+
+ foreach dir { Headers Resources Python Versions/Current } {
+ file delete ${destroot}${framewpath}/${dir}
+ }
+
+ ln -s ${framewdir}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
+
+ # Without this, LINKFORSHARED is set to
+ # ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
+ # (this becomes Python.framework/Versions/2.6/Python) which doesn't
+ # quite work (see ticket #15099); instead specifically list the
+ # full path to the proper Python framework file (which becomes
+ # ${prefix}/Library/Frameworks/Python.framework/Versions/2.6/Python)
+ reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${framewdir}/lib/python${branch}/config/Makefile
+
+ # The framework version.plist isn't currently being installed so
+ # we'll copy ours for now (see http://trac.macports.org/ticket/18773 and
+ # http://bugs.python.org/issue4937)
+ xinstall -m 644 ${filespath}/version.plist \
+ ${destroot}${framewdir}/Resources/version.plist
+}
+
+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 {
+ post-configure {
+ # See http://trac.macports.org/ticket/18376
+ system "cd ${worksrcpath} && ed - pyconfig.h < ${filespath}/pyconfig.ed"
+ }
+}
+
+platform darwin 7 {
+ # there is no SystemStubs on 10.3
+ post-patch {
+ reinplace "s|-lSystemStubs||g" ${worksrcpath}/configure \
+ ${worksrcpath}/configure.in
+ }
+ post-configure {
+ reinplace "s|-lSystemStubs||g" ${worksrcpath}/Makefile.pre.in \
+ ${worksrcpath}/Makefile.pre ${worksrcpath}/Makefile
+ }
+ # To avoid GCC incompatibility issue. See http://nxg.me.uk/note/2004/restFP/ (by ebgssth at gmail.com, ticket #13322)
+ configure.ldflags-append "-lcc_dynamic"
+}
+
+platform darwin 10 {
+ configure.compiler gcc-4.2
+}
+
+variant universal {
+ post-patch {
+ set universal_arch_flags {}
+ set arch_run_32bit {}
+ foreach arch ${universal_archs} {
+ lappend universal_arch_flags -arch ${arch}
+ if { ${arch}=="i386" || ${arch}=="ppc" } {
+ lappend arch_run_32bit -${arch}
+ }
+ }
+ reinplace \
+ "s|UNIVERSAL_ARCH_FLAGS=\".*\"|UNIVERSAL_ARCH_FLAGS=\"${universal_arch_flags}\"|" \
+ ${worksrcpath}/configure
+ reinplace \
+ "s|ARCH_RUN_32BIT=\".*\"|ARCH_RUN_32BIT=\"arch ${arch_run_32bit}\"|" \
+ ${worksrcpath}/configure
+ }
+ configure.args-append --enable-universalsdk=${universal_sysroot}
+}
+
+variant ucs4 description {Enable support for UCS4} {
+ configure.args-append --enable-unicode=ucs4
+}
+
+#livecheck.check regex
+#livecheck.url ${homepage}download/releases/
+#livecheck.regex Python (${branch}(?:\\.\\d+)*)
diff --git a/packaging/macosx/ports/lang/python26/files/patch-Lib-cgi.py.diff b/packaging/macosx/ports/lang/python26/files/patch-Lib-cgi.py.diff
new file mode 100644
index 000000000..fb861bc82
--- /dev/null
+++ b/packaging/macosx/ports/lang/python26/files/patch-Lib-cgi.py.diff
@@ -0,0 +1,18 @@
+--- Lib/cgi.py.orig 2006-08-10 19:41:07.000000000 +0200
++++ Lib/cgi.py 2007-08-21 15:36:54.000000000 +0200
+@@ -1,13 +1,6 @@
+-#! /usr/local/bin/python
++#! @@PREFIX@@/bin/python2.6
+
+-# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
+-# intentionally NOT "/usr/bin/env python". On many systems
+-# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
+-# scripts, and /usr/local/bin is the default directory where Python is
+-# installed, so /usr/bin/env would be unable to find python. Granted,
+-# binary installations by Linux vendors often install Python in
+-# /usr/bin. So let those vendors patch cgi.py to match their choice
+-# of installation.
++# NOTE: /usr/local/bin/python patched for MacPorts installation
+
+ """Support module for CGI (Common Gateway Interface) scripts.
+
diff --git a/packaging/macosx/ports/lang/python26/files/patch-Lib-distutils-dist.py.diff b/packaging/macosx/ports/lang/python26/files/patch-Lib-distutils-dist.py.diff
new file mode 100644
index 000000000..45276c555
--- /dev/null
+++ b/packaging/macosx/ports/lang/python26/files/patch-Lib-distutils-dist.py.diff
@@ -0,0 +1,51 @@
+--- Lib/distutils/dist.py.orig 2008-09-03 05:13:56.000000000 -0600
++++ Lib/distutils/dist.py 2008-10-03 18:33:47.000000000 -0600
+@@ -60,6 +60,7 @@
+ ('quiet', 'q', "run quietly (turns verbosity off)"),
+ ('dry-run', 'n', "don't actually do anything"),
+ ('help', 'h', "show detailed help message"),
++ ('no-user-cfg', None,'ignore pydistutils.cfg in your home directory'),
+ ]
+
+ # 'common_usage' is a short (2-3 line) string describing the common
+@@ -267,6 +268,12 @@
+ else:
+ sys.stderr.write(msg + "\n")
+
++ # no-user-cfg is handled before other command line args
++ # because other args override the config files, and this
++ # one is needed before we can load the config files.
++ # If attrs['script_args'] wasn't passed, assume false.
++ self.want_user_cfg = '--no-user-cfg' not in (self.script_args or [])
++
+ self.finalize_options()
+
+ # __init__ ()
+@@ -327,6 +334,9 @@
+ Distutils __inst__.py file lives), a file in the user's home
+ directory named .pydistutils.cfg on Unix and pydistutils.cfg
+ on Windows/Mac, and setup.cfg in the current directory.
++
++ The file in the user's home directory can be disabled with the
++ --no-user-cfg option.
+ """
+ files = []
+ check_environ()
+@@ -347,7 +357,7 @@
+
+ # And look for the user config file
+ user_file = os.path.join(os.path.expanduser('~'), user_filename)
+- if os.path.isfile(user_file):
++ if self.want_user_cfg and os.path.isfile(user_file):
+ files.append(user_file)
+
+ # All platforms support local setup.cfg
+@@ -355,6 +365,8 @@
+ if os.path.isfile(local_file):
+ files.append(local_file)
+
++ if DEBUG:
++ print "using config files: %s" % ', '.join(files)
+ return files
+
+ # find_config_files ()
diff --git a/packaging/macosx/ports/lang/python26/files/patch-Mac-IDLE-Makefile.in.diff b/packaging/macosx/ports/lang/python26/files/patch-Mac-IDLE-Makefile.in.diff
new file mode 100644
index 000000000..bafcf4715
--- /dev/null
+++ b/packaging/macosx/ports/lang/python26/files/patch-Mac-IDLE-Makefile.in.diff
@@ -0,0 +1,11 @@
+--- Mac/IDLE/Makefile.in.orig 2008-07-17 23:48:03.000000000 -0600
++++ Mac/IDLE/Makefile.in 2008-10-04 19:50:50.000000000 -0600
+@@ -22,7 +22,7 @@
+
+ BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py
+
+-PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
++PYTHONAPPSDIR=@@APPLICATIONS_DIR@@/$(PYTHONFRAMEWORK) $(VERSION)
+
+ all: IDLE.app
+
diff --git a/packaging/macosx/ports/lang/python26/files/patch-Mac-Makefile.in.diff b/packaging/macosx/ports/lang/python26/files/patch-Mac-Makefile.in.diff
new file mode 100644
index 000000000..cfa5f88ff
--- /dev/null
+++ b/packaging/macosx/ports/lang/python26/files/patch-Mac-Makefile.in.diff
@@ -0,0 +1,11 @@
+--- Mac/Makefile.in.orig 2008-07-22 01:06:33.000000000 -0600
++++ Mac/Makefile.in 2008-10-04 19:51:40.000000000 -0600
+@@ -18,7 +18,7 @@
+
+ # These are normally glimpsed from the previous set
+ bindir=$(prefix)/bin
+-PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
++PYTHONAPPSDIR=@@APPLICATIONS_DIR@@/$(PYTHONFRAMEWORK) $(VERSION)
+ APPINSTALLDIR=$(prefix)/Resources/Python.app
+
+ # Variables for installing the "normal" unix binaries
diff --git a/packaging/macosx/ports/lang/python26/files/patch-Mac-PythonLauncher-Makefile.in.diff b/packaging/macosx/ports/lang/python26/files/patch-Mac-PythonLauncher-Makefile.in.diff
new file mode 100644
index 000000000..be74da903
--- /dev/null
+++ b/packaging/macosx/ports/lang/python26/files/patch-Mac-PythonLauncher-Makefile.in.diff
@@ -0,0 +1,11 @@
+--- Mac/PythonLauncher/Makefile.in.orig 2008-05-02 13:58:56.000000000 -0600
++++ Mac/PythonLauncher/Makefile.in 2008-10-04 19:52:27.000000000 -0600
+@@ -21,7 +21,7 @@
+
+ BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py
+
+-PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
++PYTHONAPPSDIR=@@APPLICATIONS_DIR@@/$(PYTHONFRAMEWORK) $(VERSION)
+ OBJECTS=FileSettings.o MyAppDelegate.o MyDocument.o PreferencesWindowController.o doscript.o main.o
+
+ all: Python\ Launcher.app
diff --git a/packaging/macosx/ports/lang/python26/files/patch-Mac-Tools-Doc-setup.py.diff b/packaging/macosx/ports/lang/python26/files/patch-Mac-Tools-Doc-setup.py.diff
new file mode 100644
index 000000000..63e4e11d2
--- /dev/null
+++ b/packaging/macosx/ports/lang/python26/files/patch-Mac-Tools-Doc-setup.py.diff
@@ -0,0 +1,11 @@
+--- Mac/Tools/Doc/setup.py.diff 2008-03-29 09:24:25.000000000 -0600
++++ Mac/Tools/Doc/setup.py 2008-10-04 19:53:40.000000000 -0600
+@@ -30,7 +30,7 @@
+
+ MAJOR_VERSION='2.4'
+ MINOR_VERSION='2.4.1'
+-DESTDIR='/Applications/MacPython-%s/PythonIDE.app/Contents/Resources/English.lproj/PythonDocumentation' % MAJOR_VERSION
++DESTDIR='@@APPLICATIONS_DIR@@/MacPython-%s/PythonIDE.app/Contents/Resources/English.lproj/PythonDocumentation' % MAJOR_VERSION
+
+ class DocBuild(build):
+ def initialize_options(self):
diff --git a/packaging/macosx/ports/lang/python26/files/patch-Makefile.pre.in.diff b/packaging/macosx/ports/lang/python26/files/patch-Makefile.pre.in.diff
new file mode 100644
index 000000000..60cd69706
--- /dev/null
+++ b/packaging/macosx/ports/lang/python26/files/patch-Makefile.pre.in.diff
@@ -0,0 +1,31 @@
+--- Makefile.pre.in.orig 2008-06-19 20:47:03.000000000 -0600
++++ Makefile.pre.in 2008-07-28 19:57:15.000000000 -0600
+@@ -394,8 +394,8 @@
+ # Build the shared modules
+ sharedmods: $(BUILDPYTHON)
+ @case $$MAKEFLAGS in \
+- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
+- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
++ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q --no-user-cfg build;; \
++ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py --no-user-cfg build;; \
+ esac
+
+ # Build static library
+@@ -993,7 +993,7 @@
+ # Install the dynamically loadable modules
+ # This goes into $(exec_prefix)
+ sharedinstall:
+- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
++ $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py --no-user-cfg install \
+ --prefix=$(prefix) \
+ --install-scripts=$(BINDIR) \
+ --install-platlib=$(DESTSHARED) \
+@@ -1073,7 +1073,7 @@
+ # This installs a few of the useful scripts in Tools/scripts
+ scriptsinstall:
+ SRCDIR=$(srcdir) $(RUNSHARED) \
+- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
++ ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py --no-user-cfg install \
+ --prefix=$(prefix) \
+ --install-scripts=$(BINDIR) \
+ --root=/$(DESTDIR)
diff --git a/packaging/macosx/ports/lang/python26/files/patch-setup.py.diff b/packaging/macosx/ports/lang/python26/files/patch-setup.py.diff
new file mode 100644
index 000000000..3acb4ac2b
--- /dev/null
+++ b/packaging/macosx/ports/lang/python26/files/patch-setup.py.diff
@@ -0,0 +1,16 @@
+--- setup.py.orig 2008-09-29 18:15:45.000000000 -0600
++++ setup.py 2008-11-30 23:13:09.000000000 -0700
+@@ -1506,13 +1506,7 @@
+ def detect_tkinter(self, inc_dirs, lib_dirs):
+ # The _tkinter module.
+
+- # Rather than complicate the code below, detecting and building
+- # AquaTk is a separate method. Only one Tkinter will be built on
+- # Darwin - either AquaTk, if it is found, or X11 based Tk.
+ platform = self.get_platform()
+- if (platform == 'darwin' and
+- self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
+- return
+
+ # Assume we haven't found any of the libraries or include files
+ # The versions with dots are used on Unix, and the versions without
diff --git a/packaging/macosx/ports/lang/python26/files/pyconfig.ed b/packaging/macosx/ports/lang/python26/files/pyconfig.ed
new file mode 100644
index 000000000..671d0d560
--- /dev/null
+++ b/packaging/macosx/ports/lang/python26/files/pyconfig.ed
@@ -0,0 +1,2 @@
+g,.*\(HAVE_POLL[_A-Z]*\).*,s,,/* #undef \1 */,
+w
diff --git a/packaging/macosx/ports/lang/python26/files/python26 b/packaging/macosx/ports/lang/python26/files/python26
new file mode 100644
index 000000000..5be5fa655
--- /dev/null
+++ b/packaging/macosx/ports/lang/python26/files/python26
@@ -0,0 +1,12 @@
+bin/python2.6
+bin/pythonw2.6
+bin/python2.6-config
+bin/idle2.6
+bin/pydoc2.6
+bin/smtpd2.6.py
+-
+share/man/man1/python2.6.1.gz
+${frameworks_dir}/Library/Frameworks/Python.framework/Versions/2.6
+${frameworks_dir}/Library/Frameworks/Python.framework/Versions/2.6/Headers
+${frameworks_dir}/Library/Frameworks/Python.framework/Versions/2.6/Resources
+${frameworks_dir}/Library/Frameworks/Python.framework/Versions/2.6/Python
diff --git a/packaging/macosx/ports/lang/python26/files/version.plist b/packaging/macosx/ports/lang/python26/files/version.plist
new file mode 100644
index 000000000..acdfe5bac
--- /dev/null
+++ b/packaging/macosx/ports/lang/python26/files/version.plist
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>BuildVersion</key>
+ <string>1</string>
+ <key>CFBundleShortVersionString</key>
+ <string>2.6.1</string>
+ <key>CFBundleVersion</key>
+ <string>2.6.1</string>
+ <key>ProjectName</key>
+ <string>Python</string>
+ <key>SourceVersion</key>
+ <string>2.6.1</string>
+</dict>
+</plist>
diff --git a/packaging/macosx/ports/python/py-Pillow/Portfile b/packaging/macosx/ports/python/py-Pillow/Portfile
new file mode 100644
index 000000000..6935fab95
--- /dev/null
+++ b/packaging/macosx/ports/python/py-Pillow/Portfile
@@ -0,0 +1,74 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id: Portfile 124123 2014-08-19 13:57:18Z stromnov@macports.org $
+
+PortSystem 1.0
+PortGroup python 1.0
+
+name py-Pillow
+version 2.5.3
+revision 100
+categories-append devel
+platforms darwin
+license BSD
+
+python.versions 26 27 32 33 34
+
+maintainers stromnov openmaintainer
+
+description Python Imaging Library (fork)
+
+long_description ${description}
+
+homepage http://github.com/python-imaging/Pillow
+master_sites http://pypi.python.org/packages/source/P/Pillow/
+
+distname Pillow-${version}
+
+checksums rmd160 f10cda34a62022edf3bfe626096b6bc009a74dc8 \
+ sha256 62ff6c6cb88d4a1d6e856315b1691186b06cb923f18fde86d6abac9eeb9096d1
+
+if {${name} ne ${subport}} {
+ use_zip yes
+
+ conflicts py${python.version}-pil
+
+ depends_build port:py${python.version}-setuptools
+ depends_lib-append \
+ port:zlib \
+ port:jpeg \
+ port:tiff \
+ port:lcms \
+ port:webp \
+ port:openjpeg \
+ port:freetype
+
+ patchfiles patch-setup.py.diff
+
+ post-patch {
+ reinplace "s|@prefix@|${prefix}|g" ${worksrcpath}/setup.py
+ }
+
+ livecheck.type none
+} else {
+ livecheck.type regex
+ livecheck.url ${master_sites}
+ livecheck.regex {Pillow-(\d+(?:\.\d+)*)\.[tz]}
+}
+
+variant quartz conflicts x11 tkinter {
+ # tkinter doesn't build
+}
+
+variant x11 conflicts quartz {
+ # tkinter does build
+}
+
+variant tkinter description {with tkinter support} {
+ if {$subport != $name} {
+ depends_lib-append port:py${python.version}-tkinter
+ }
+}
+
+if { ![variant_isset quartz] } {
+ default_variants-append +tkinter
+}
diff --git a/packaging/macosx/ports/python/py-Pillow/files/patch-setup.py.diff b/packaging/macosx/ports/python/py-Pillow/files/patch-setup.py.diff
new file mode 100644
index 000000000..fe300cfe5
--- /dev/null
+++ b/packaging/macosx/ports/python/py-Pillow/files/patch-setup.py.diff
@@ -0,0 +1,120 @@
+--- setup.py.orig 2014-07-04 17:25:36.000000000 +0200
++++ setup.py 2014-07-04 17:33:05.000000000 +0200
+@@ -19,7 +19,7 @@
+ from setuptools import Extension, setup, find_packages
+
+ # monkey patch import hook. Even though flake8 says it's not used, it is.
+-# comment this out to disable multi threaded builds.
++# comment this out to disable multi threaded builds.
+ import mp_compile
+
+ _IMAGING = (
+@@ -200,44 +200,8 @@
+ "/usr/lib", "python%s" % sys.version[:3], "config"))
+
+ elif sys.platform == "darwin":
+- # attempt to make sure we pick freetype2 over other versions
+- _add_directory(include_dirs, "/sw/include/freetype2")
+- _add_directory(include_dirs, "/sw/lib/freetype2/include")
+- # fink installation directories
+- _add_directory(library_dirs, "/sw/lib")
+- _add_directory(include_dirs, "/sw/include")
+- # darwin ports installation directories
+- _add_directory(library_dirs, "/opt/local/lib")
+- _add_directory(include_dirs, "/opt/local/include")
+-
+- # if Homebrew is installed, use its lib and include directories
+- import subprocess
+- try:
+- prefix = subprocess.check_output(
+- ['brew', '--prefix']
+- ).strip().decode('latin1')
+- except:
+- # Homebrew not installed
+- prefix = None
+-
+- ft_prefix = None
+-
+- if prefix:
+- # add Homebrew's include and lib directories
+- _add_directory(library_dirs, os.path.join(prefix, 'lib'))
+- _add_directory(include_dirs, os.path.join(prefix, 'include'))
+- ft_prefix = os.path.join(prefix, 'opt', 'freetype')
+-
+- if ft_prefix and os.path.isdir(ft_prefix):
+- # freetype might not be linked into Homebrew's prefix
+- _add_directory(library_dirs, os.path.join(ft_prefix, 'lib'))
+- _add_directory(
+- include_dirs, os.path.join(ft_prefix, 'include'))
+- else:
+- # fall back to freetype from XQuartz if
+- # Homebrew's freetype is missing
+- _add_directory(library_dirs, "/usr/X11/lib")
+- _add_directory(include_dirs, "/usr/X11/include")
++ _add_directory(library_dirs, "@prefix@/lib")
++ _add_directory(include_dirs, "@prefix@/include")
+
+ elif sys.platform.startswith("linux"):
+ arch_tp = (plat.processor(), plat.architecture()[0])
+@@ -337,21 +301,6 @@
+ else:
+ TCL_ROOT = None
+
+- # add standard directories
+-
+- # look for tcl specific subdirectory (e.g debian)
+- if _tkinter:
+- tcl_dir = "/usr/include/tcl" + TCL_VERSION
+- if os.path.isfile(os.path.join(tcl_dir, "tk.h")):
+- _add_directory(include_dirs, tcl_dir)
+-
+- # standard locations
+- _add_directory(library_dirs, "/usr/local/lib")
+- _add_directory(include_dirs, "/usr/local/include")
+-
+- _add_directory(library_dirs, "/usr/lib")
+- _add_directory(include_dirs, "/usr/include")
+-
+ # on Windows, look for the OpenJPEG libraries in the location that
+ # the official installer puts them
+ if sys.platform == "win32":
+@@ -410,7 +359,7 @@
+ for directory in self.compiler.include_dirs:
+ try:
+ listdir = os.listdir(directory)
+- except Exception:
++ except Exception:
+ # WindowsError, FileNotFoundError
+ continue
+ for name in listdir:
+@@ -570,29 +519,7 @@
+ exts.append(Extension(
+ "PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs))
+
+- if sys.platform == "darwin":
+- # locate Tcl/Tk frameworks
+- frameworks = []
+- framework_roots = [
+- "/Library/Frameworks",
+- "/System/Library/Frameworks"]
+- for root in framework_roots:
+- if (
+- os.path.exists(os.path.join(root, "Tcl.framework")) and
+- os.path.exists(os.path.join(root, "Tk.framework"))):
+- print("--- using frameworks at %s" % root)
+- frameworks = ["-framework", "Tcl", "-framework", "Tk"]
+- dir = os.path.join(root, "Tcl.framework", "Headers")
+- _add_directory(self.compiler.include_dirs, dir, 0)
+- dir = os.path.join(root, "Tk.framework", "Headers")
+- _add_directory(self.compiler.include_dirs, dir, 1)
+- break
+- if frameworks:
+- exts.append(Extension(
+- "PIL._imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
+- extra_compile_args=frameworks, extra_link_args=frameworks))
+- feature.tcl = feature.tk = 1 # mark as present
+- elif feature.tcl and feature.tk:
++ if feature.tcl and feature.tk:
+ exts.append(Extension(
+ "PIL._imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
+ libraries=[feature.tcl, feature.tk]))
diff --git a/packaging/macosx/ports/python/py-sk1libs/Portfile b/packaging/macosx/ports/python/py-sk1libs/Portfile
new file mode 100644
index 000000000..0c152ce8c
--- /dev/null
+++ b/packaging/macosx/ports/python/py-sk1libs/Portfile
@@ -0,0 +1,64 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id$
+
+PortSystem 1.0
+PortGroup python 1.0
+
+name py-sk1libs
+version 0.9.1
+revision 101
+license LGPL-2
+maintainers nomaintainer
+categories python graphics
+platforms darwin
+homepage http://sk1project.org/
+
+description Set of python non-GUI extensions for sK1 Project
+
+long_description \
+ sk1libs is a set of python non-GUI extensions for sK1 Project. \
+ The package includes multiplatform non-GUI extensions which are \
+ usually native extensions.
+
+distname sk1libs-${version}
+# MacPorts does not properly support URLs with a get parameter.
+# Workaround for this bug: https://trac.macports.org/wiki/PortfileRecipes#fetchwithgetparams
+master_sites http://sk1project.org/dc.php?target=${distfiles}&dummy=
+
+checksums md5 e18088bbc8a105e7535a96f40b80f284 \
+ sha1 dd948558128bb6547b1f277087bf3066104912da \
+ rmd160 38f22205e0b5b6078e31ec6dc4c1d93845533046
+
+python.versions 25 26 27
+
+if {$subport != $name} {
+
+ depends_lib-append \
+ port:freetype \
+ port:jpeg \
+ port:lcms \
+ port:zlib
+
+ depends_run-append \
+ port:py${python.version}-pil
+
+ variant Pillow {
+ depends_run-delete port:py${python.version}-pil
+ depends_run-append port:py${python.version}-Pillow
+ }
+
+ patchfiles \
+ patch-src-utils-fs.py.diff \
+ patch-src-imaging-libimagingft-_imagingft.c.diff
+
+ post-patch {
+ reinplace "s|'/usr/include/freetype2'|'${prefix}/include/freetype2'|g" ${worksrcpath}/setup.py
+ reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/src/utils/fs.py
+ }
+}
+
+default_variants +Pillow
+
+livecheck.type regex
+livecheck.url http://sk1project.org/modules.php?name=Products&product=uniconvertor&op=download
+livecheck.regex "sk1libs-(\\d+(?:\\.\\d+)*)${extract.suffix}"
diff --git a/packaging/macosx/ports/python/py-sk1libs/files/patch-src-imaging-libimagingft-_imagingft.c.diff b/packaging/macosx/ports/python/py-sk1libs/files/patch-src-imaging-libimagingft-_imagingft.c.diff
new file mode 100644
index 000000000..1d69461a3
--- /dev/null
+++ b/packaging/macosx/ports/python/py-sk1libs/files/patch-src-imaging-libimagingft-_imagingft.c.diff
@@ -0,0 +1,16 @@
+--- src/imaging/libimagingft/_imagingft.c.orig 2014-07-13 00:37:57.000000000 +0200
++++ src/imaging/libimagingft/_imagingft.c 2014-07-13 00:41:08.000000000 +0200
+@@ -70,7 +70,13 @@
+ const char* message;
+ } ft_errors[] =
+
++#if defined(USE_FREETYPE_2_1)
++/* freetype 2.1 and newer */
++#include FT_ERRORS_H
++#else
++/* freetype 2.0 */
+ #include <freetype/fterrors.h>
++#endif
+
+ /* -------------------------------------------------------------------- */
+ /* font objects */
diff --git a/packaging/macosx/ports/python/py-sk1libs/files/patch-src-utils-fs.py.diff b/packaging/macosx/ports/python/py-sk1libs/files/patch-src-utils-fs.py.diff
new file mode 100644
index 000000000..541935e71
--- /dev/null
+++ b/packaging/macosx/ports/python/py-sk1libs/files/patch-src-utils-fs.py.diff
@@ -0,0 +1,26 @@
+--- src/utils/fs.py.orig 2010-05-23 12:46:21.000000000 +0200
++++ src/utils/fs.py 2013-01-18 15:40:02.000000000 +0100
+@@ -220,8 +220,14 @@
+ finally:
+ _winreg.CloseKey( k )
+ if system.get_os_family()==system.MACOSX:
+- #FIXME: It's a stub. The paths should be more exact.
+- return ['/',]
++ return ['__PREFIX__/share/fonts',
++ '/usr/share/fonts',
++ '/opt/X11/lib/X11/fonts',
++ '/System/Library/Fonts',
++ '/Network/Library/Fonts',
++ '/Library/Fonts',
++ os.path.expanduser("~/Library/Fonts"),
++ os.path.expanduser("~/.fonts")]
+
+
+ DIRECTORY_OBJECT=0
+@@ -311,4 +317,4 @@
+ if __name__ == '__main__':
+ _test()
+
+-
+\ No newline at end of file
++
diff --git a/packaging/macosx/ports/python/py-uniconvertor/Portfile b/packaging/macosx/ports/python/py-uniconvertor/Portfile
new file mode 100644
index 000000000..2c4a22ca0
--- /dev/null
+++ b/packaging/macosx/ports/python/py-uniconvertor/Portfile
@@ -0,0 +1,46 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id$
+
+PortSystem 1.0
+PortGroup python 1.0
+
+name py-uniconvertor
+version 1.1.5
+revision 100
+license LGPL-2 GPL-2
+maintainers nomaintainer
+categories python graphics
+platforms darwin
+homepage http://sk1project.org/modules.php?name=Products&product=uniconvertor
+
+description universal vector graphics translator.
+
+long_description \
+ UniConvertor is a universal vector graphics translator. It is a command \
+ line tool which uses sK1 object model to convert one format to another. \
+ Supported input formats include CorelDraw v7-X4 (CDR/CDT/CCX/CDRX/CMX), \
+ Adobe Illustrator v5-9 (AI), PS, EPS, CGM, WMF, XFIG, SVG, SK, SK1, AFF. \
+ Supported output formats include Adobe Illustrator AI, PS, CGM, WMF, \
+ SVG, SK, SK1, PDF.
+
+distname uniconvertor-${version}
+# MacPorts does not properly support URLs with a get parameter.
+# Workaround for this bug: https://trac.macports.org/wiki/PortfileRecipes#fetchwithgetparams
+master_sites http://sk1project.org/dc.php?target=${distfiles}&dummy=
+
+checksums md5 d1272315a58304ece2ff588834e23f72 \
+ sha1 51ec7c4487048c3357ed95cdb4ab3524018a2c9e \
+ rmd160 86211bdb7b7af7611a9db4a2e2f6101995af6850
+
+python.versions 25 26 27
+
+if {$subport != $name} {
+
+ depends_lib-append \
+ port:py${python.version}-sk1libs
+
+}
+
+livecheck.type regex
+livecheck.url http://sk1project.org/modules.php?name=Products&product=uniconvertor&op=download
+livecheck.regex "uniconvertor-(\\d+(?:\\.\\d+)*)${extract.suffix}"
diff --git a/packaging/macosx/ports/python/py25-Pillow/Portfile b/packaging/macosx/ports/python/py25-Pillow/Portfile
new file mode 100644
index 000000000..aa74a06ad
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-Pillow/Portfile
@@ -0,0 +1,77 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id: Portfile 104088 2013-03-15 14:39:56Z stromnov@macports.org $
+
+PortSystem 1.0
+PortGroup python 1.0
+
+name py25-Pillow
+set real_name py-Pillow
+version 1.7.8
+revision 100
+categories-append devel
+platforms darwin
+license BSD
+
+python.versions 25
+python.version 25
+
+maintainers stromnov openmaintainer
+
+description Python Imaging Library (fork)
+
+long_description ${description}
+
+homepage http://github.com/python-imaging/Pillow
+master_sites http://pypi.python.org/packages/source/P/Pillow/
+
+distname Pillow-${version}
+use_zip yes
+
+checksums rmd160 e52cec02d943951a80d30b32b1764cb3ae87b283 \
+ sha256 907f5342b1df1d277dcc10df2aeabc61099e5a07e0676b9fcd1bb7379890c0ee
+
+if {$subport == $name} {
+ conflicts py${python.version}-pil
+
+ depends_build port:py${python.version}-setuptools
+ depends_lib-append \
+ port:zlib \
+ port:jpeg \
+ port:tiff \
+ port:lcms \
+ port:webp \
+ port:freetype
+
+ patchfiles patch-setup.py-v1.7.8.diff \
+ patch-_imagingft.c.diff
+
+ post-patch {
+ reinplace "s|@prefix@|${prefix}|g" ${worksrcpath}/setup.py
+ }
+
+ livecheck.type none
+#} else {
+# livecheck.type regex
+# livecheck.url ${master_sites}
+# livecheck.regex "Pillow-(\\d+(?:\\.\\d+)*)${extract.suffix}"
+}
+
+variant quartz conflicts x11 tkinter {
+ # tkinter doesn't build
+}
+
+variant x11 conflicts quartz {
+ # tkinter does build
+}
+
+variant tkinter description {with tkinter support} {
+ if {$subport == $name} {
+ depends_lib-append port:py${python.version}-tkinter
+ }
+}
+
+#if { ![variant_isset quartz] } {
+# default_variants-append +tkinter
+#}
+
+default_variants -tkinter
diff --git a/packaging/macosx/ports/python/py25-Pillow/files/patch-_imagingft.c.diff b/packaging/macosx/ports/python/py25-Pillow/files/patch-_imagingft.c.diff
new file mode 100644
index 000000000..99f72a8c9
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-Pillow/files/patch-_imagingft.c.diff
@@ -0,0 +1,14 @@
+--- _imagingft.c.orig 2013-11-27 16:07:53.000000000 +0400
++++ _imagingft.c 2013-11-27 16:12:01.000000000 +0400
+@@ -70,7 +70,11 @@
+ const char* message;
+ } ft_errors[] =
+
++#if defined(USE_FREETYPE_2_1)
++#include FT_ERRORS_H
++#else
+ #include <freetype/fterrors.h>
++#endif
+
+ /* -------------------------------------------------------------------- */
+ /* font objects */
diff --git a/packaging/macosx/ports/python/py25-Pillow/files/patch-setup.py-v1.7.8.diff b/packaging/macosx/ports/python/py25-Pillow/files/patch-setup.py-v1.7.8.diff
new file mode 100644
index 000000000..2f4b797f6
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-Pillow/files/patch-setup.py-v1.7.8.diff
@@ -0,0 +1,83 @@
+--- setup.py.orig 2014-09-02 02:51:22.000000000 +0200
++++ setup.py 2014-09-02 02:53:51.000000000 +0200
+@@ -100,18 +100,9 @@
+ "/usr/lib", "python%s" % sys.version[:3], "config"))
+
+ elif sys.platform == "darwin":
+- # attempt to make sure we pick freetype2 over other versions
+- _add_directory(include_dirs, "/sw/include/freetype2")
+- _add_directory(include_dirs, "/sw/lib/freetype2/include")
+- # fink installation directories
+- _add_directory(library_dirs, "/sw/lib")
+- _add_directory(include_dirs, "/sw/include")
+ # darwin ports installation directories
+- _add_directory(library_dirs, "/opt/local/lib")
+- _add_directory(include_dirs, "/opt/local/include")
+- # freetype2 ships with X11
+- _add_directory(library_dirs, "/usr/X11/lib")
+- _add_directory(include_dirs, "/usr/X11/include")
++ _add_directory(library_dirs, "@prefix@/lib")
++ _add_directory(include_dirs, "@prefix@/include")
+
+ elif sys.platform.startswith("linux"):
+ if platform.processor() == "x86_64":
+@@ -126,9 +117,6 @@
+ # work ;-)
+ self.add_multiarch_paths()
+
+- _add_directory(library_dirs, "/usr/local/lib")
+- # FIXME: check /opt/stuff directories here?
+-
+ prefix = sysconfig.get_config_var("prefix")
+ if prefix:
+ _add_directory(library_dirs, os.path.join(prefix, "lib"))
+@@ -180,19 +168,6 @@
+ #
+ # add standard directories
+
+- # look for tcl specific subdirectory (e.g debian)
+- if _tkinter:
+- tcl_dir = "/usr/include/tcl" + TCL_VERSION
+- if os.path.isfile(os.path.join(tcl_dir, "tk.h")):
+- _add_directory(include_dirs, tcl_dir)
+-
+- # standard locations
+- _add_directory(library_dirs, "/usr/local/lib")
+- _add_directory(include_dirs, "/usr/local/include")
+-
+- _add_directory(library_dirs, "/usr/lib")
+- _add_directory(include_dirs, "/usr/include")
+-
+ #
+ # insert new dirs *before* default libs, to avoid conflicts
+ # between Python PYD stub libs and real libraries
+@@ -307,28 +282,7 @@
+ exts.append(Extension(
+ "_imagingcms", ["_imagingcms.c"], libraries=["lcms"] + extra))
+
+- if sys.platform == "darwin":
+- # locate Tcl/Tk frameworks
+- frameworks = []
+- framework_roots = [
+- "/Library/Frameworks",
+- "/System/Library/Frameworks"]
+- for root in framework_roots:
+- if (os.path.exists(os.path.join(root, "Tcl.framework")) and
+- os.path.exists(os.path.join(root, "Tk.framework"))):
+- print("--- using frameworks at %s" % root)
+- frameworks = ["-framework", "Tcl", "-framework", "Tk"]
+- dir = os.path.join(root, "Tcl.framework", "Headers")
+- _add_directory(self.compiler.include_dirs, dir, 0)
+- dir = os.path.join(root, "Tk.framework", "Headers")
+- _add_directory(self.compiler.include_dirs, dir, 1)
+- break
+- if frameworks:
+- exts.append(Extension(
+- "_imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
+- extra_compile_args=frameworks, extra_link_args=frameworks))
+- feature.tcl = feature.tk = 1 # mark as present
+- elif feature.tcl and feature.tk:
++ if feature.tcl and feature.tk:
+ exts.append(Extension(
+ "_imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
+ libraries=[feature.tcl, feature.tk]))
diff --git a/packaging/macosx/ports/python/py25-lxml/Portfile b/packaging/macosx/ports/python/py25-lxml/Portfile
new file mode 100644
index 000000000..49a753cd1
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-lxml/Portfile
@@ -0,0 +1,51 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
+# $Id: Portfile 121661 2014-07-03 17:50:11Z mf2k@macports.org $
+
+PortSystem 1.0
+PortGroup python 1.0
+
+name py25-lxml
+version 3.3.5
+revision 0
+categories-append devel
+platforms darwin
+license BSD
+
+python.versions 25
+
+maintainers gmail.com:dbraband openmaintainer
+
+description Powerful and Pythonic XML processing library
+
+long_description lxml is a Pythonic binding for the libxml2 and \
+ libxslt libraries. It is unique in that it \
+ combines the speed and feature completeness of \
+ these libraries with the simplicity of a native \
+ Python API, mostly compatible but superior to \
+ the well-known ElementTree API.
+
+homepage http://lxml.de/
+master_sites http://pypi.python.org/packages/source/l/lxml/
+
+checksums rmd160 c7ccece50f8d20f5fac44ac1bf8dc0d8a85aa0f9 \
+ sha256 6ad6949dc7eea744a30fba77a968dd5910f545220e58bcc813b9df5c793e318a
+
+distname lxml-${version}
+
+if {${name} eq ${subport}} {
+
+ revision 100
+
+ depends_build-append \
+ port:py${python.version}-setuptools
+
+ depends_lib-append port:zlib \
+ port:libxml2 \
+ port:libxslt
+
+ livecheck.type none
+} else {
+ livecheck.type regex
+ livecheck.url ${master_sites}
+ livecheck.regex "lxml-(\\d+(?:\\.\\d+)*)${extract.suffix}"
+}
diff --git a/packaging/macosx/ports/python/py25-nose/Portfile b/packaging/macosx/ports/python/py25-nose/Portfile
new file mode 100644
index 000000000..62a60eec5
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-nose/Portfile
@@ -0,0 +1,86 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id: Portfile 121661 2014-07-03 17:50:11Z mf2k@macports.org $
+
+PortSystem 1.0
+PortGroup python 1.0
+PortGroup select 1.0
+
+set my_name nose
+name py25-${my_name}
+version 1.3.1
+categories-append www
+license LGPL-2+
+maintainers mcalhoun openmaintainer
+description A Python unittest extension.
+long_description \
+ A unittest extension offering automatic test \
+ suite discovery, simplified test authoring, \
+ and output capture. Nose provides an alternate \
+ test discovery and running process for \
+ unittest, one that is intended to mimic the \
+ behavior of py.test as much as is reasonably \
+ possible without resorting to magic.
+
+platforms darwin
+supported_archs noarch
+
+homepage http://somethingaboutorange.com/mrl/projects/${my_name}
+master_sites http://pypi.python.org/packages/source/n/${my_name}/
+distname ${my_name}-${version}
+
+checksums md5 672398801ddf5ba745c55c6eed79c5aa \
+ rmd160 7bf311d3d54f2ccb372dea331708c475b992ccec \
+ sha256 85273b87ab3db9307e3b1452b071e25c1db1cc812bc337d2a97ea0b0cf2ab6ba
+
+python.versions 25
+
+# already installs version-suffixed executables
+python.link_binaries no
+python.move_binaries no
+
+depends_run-append port:nosetests_select
+if {${name} eq ${subport}} {
+
+ revision 100
+
+ select.group nosetests
+ select.file ${filespath}/nosetests${python.version}
+
+ depends_lib port:py${python.version}-setuptools
+
+ post-patch {
+ reinplace "s|man/man|share/man/man|" ${worksrcpath}/setup.py
+
+ # One of the tests fails if this directory does not exist
+ file mkdir ${worksrcpath}/functional_tests/support/empty
+ }
+
+ post-destroot {
+ if {${python.version} == "24" || ${python.version} == "25"} {
+ move ${destroot}${prefix}/share/man/man1/nosetests.1 ${destroot}${prefix}/share/man/man1/nosetests${python.branch}.1
+ delete ${destroot}${prefix}/bin/nosetests
+ } else {
+ ln -s ${python.prefix}/bin/nosetests-${python.branch} ${destroot}${prefix}/bin/
+ ln -s ${python.prefix}/share/man/man1/nosetests.1 ${destroot}${prefix}/share/man/man1/nosetests${python.branch}.1
+ }
+
+ xinstall -m 644 -W ${worksrcpath} \
+ AUTHORS CHANGELOG NEWS README.txt \
+ ${destroot}${prefix}/share/doc/${subport}
+
+ file copy ${worksrcpath}/doc ${destroot}${prefix}/share/doc/${subport}/html
+
+ file delete ${destroot}${prefix}/share/doc/${subport}/examples
+ file copy ${worksrcpath}/examples ${destroot}${prefix}/share/doc/${subport}
+ }
+
+ test.run yes
+ test.cmd ${python.bin} setup.py test
+
+ livecheck.type none
+
+#} else {
+# livecheck.type regex
+# livecheck.url ${master_sites}
+# livecheck.regex "${my_name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
+}
diff --git a/packaging/macosx/ports/python/py25-nose/files/nosetests24 b/packaging/macosx/ports/python/py25-nose/files/nosetests24
new file mode 100644
index 000000000..d9a8f4034
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-nose/files/nosetests24
@@ -0,0 +1 @@
+bin/nosetests-2.4
diff --git a/packaging/macosx/ports/python/py25-nose/files/nosetests25 b/packaging/macosx/ports/python/py25-nose/files/nosetests25
new file mode 100644
index 000000000..95864c283
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-nose/files/nosetests25
@@ -0,0 +1 @@
+bin/nosetests-2.5
diff --git a/packaging/macosx/ports/python/py25-nose/files/nosetests26 b/packaging/macosx/ports/python/py25-nose/files/nosetests26
new file mode 100644
index 000000000..bb670776f
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-nose/files/nosetests26
@@ -0,0 +1 @@
+bin/nosetests-2.6
diff --git a/packaging/macosx/ports/python/py25-nose/files/nosetests27 b/packaging/macosx/ports/python/py25-nose/files/nosetests27
new file mode 100644
index 000000000..28c7bfe8c
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-nose/files/nosetests27
@@ -0,0 +1 @@
+bin/nosetests-2.7
diff --git a/packaging/macosx/ports/python/py25-nose/files/nosetests31 b/packaging/macosx/ports/python/py25-nose/files/nosetests31
new file mode 100644
index 000000000..5ba27a4d5
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-nose/files/nosetests31
@@ -0,0 +1 @@
+bin/nosetests-3.1
diff --git a/packaging/macosx/ports/python/py25-nose/files/nosetests32 b/packaging/macosx/ports/python/py25-nose/files/nosetests32
new file mode 100644
index 000000000..07bfb86a1
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-nose/files/nosetests32
@@ -0,0 +1 @@
+bin/nosetests-3.2
diff --git a/packaging/macosx/ports/python/py25-nose/files/nosetests33 b/packaging/macosx/ports/python/py25-nose/files/nosetests33
new file mode 100644
index 000000000..b750d806b
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-nose/files/nosetests33
@@ -0,0 +1 @@
+bin/nosetests-3.3
diff --git a/packaging/macosx/ports/python/py25-nose/files/nosetests34 b/packaging/macosx/ports/python/py25-nose/files/nosetests34
new file mode 100644
index 000000000..542ffc949
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-nose/files/nosetests34
@@ -0,0 +1 @@
+bin/nosetests-3.4
diff --git a/packaging/macosx/ports/python/py25-numpy/Portfile b/packaging/macosx/ports/python/py25-numpy/Portfile
new file mode 100644
index 000000000..4575d6293
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-numpy/Portfile
@@ -0,0 +1,209 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
+# $Id: Portfile 113172 2013-11-11 10:24:44Z jeremyhu@macports.org $
+
+PortSystem 1.0
+PortGroup python 1.0
+PortGroup github 1.0
+
+github.setup numpy numpy 1.7.1 v
+name py25-numpy
+revision 1
+dist_subdir ${name}/${version}_1
+
+categories-append math
+license BSD
+platforms darwin
+maintainers dh michaelld openmaintainer
+description The core utilities for the scientific library scipy for Python
+long_description ${description}
+
+checksums rmd160 16df4216f40b22077e1f14cc41b8c8ae486b45af \
+ sha256 14964724915e5fa1ed34d2cdb93eed5a86bc16edd4a1203cf521ad8bbbcb5215
+
+python.versions 25
+
+if {$subport == $name} {
+
+ revision 100
+
+ patchfiles patch-f2py_setup.py.diff \
+ patch-numpy_distutils_fcompiler___init__.py.diff \
+ patch-fcompiler_g95.diff
+
+ depends_lib-append port:fftw-3 \
+ port:py${python.version}-nose
+
+ # http://trac.macports.org/ticket/34562
+ destroot.env-append \
+ CC="${configure.cc}" \
+ CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
+ CXX="${configure.cxx}" \
+ CXXFLAGS="${configure.cxxflags} [get_canonical_archflags cxx]" \
+ OBJC="${configure.objc}" \
+ OBJCFLAGS="${configure.objcflags} [get_canonical_archflags objc]" \
+ LDFLAGS="${configure.ldflags} [get_canonical_archflags ld]"
+
+ build.env-append ARCHFLAGS="[get_canonical_archflags ld]"
+ destroot.env-append ARCHFLAGS="[get_canonical_archflags ld]"
+
+ variant atlas description {Use the MacPorts' ATLAS libraries \
+ instead of Apple's Accelerate framework} {
+ build.env-append ATLAS=${prefix}/lib \
+ LAPACK=${prefix}/lib \
+ BLAS=${prefix}/lib
+ destroot.env-append ATLAS=${prefix}/lib \
+ LAPACK=${prefix}/lib \
+ BLAS=${prefix}/lib
+ depends_lib-append port:atlas
+
+ if {[variant_isset universal]} {
+ python.set_compiler no
+ }
+ }
+
+ # when using ATLAS (whether by default or specified by the user via
+ # the +atlas variant) ...
+ set gcc_version ""
+ if {[variant_isset atlas]} {
+
+ # see if the user has set -gcc4X to disable using MacPorts'
+ # compiler; if not, either use what the user set (as +gcc4X) or
+ # default to gcc47.
+
+ variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 gcc48 \
+ description {Use the gcc43 compiler (enables fortran linking)} {
+ configure.compiler macports-gcc-4.3
+ }
+
+ variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 gcc48 \
+ description {Use the gcc44 compiler (enables fortran linking)} {
+ configure.compiler macports-gcc-4.4
+ }
+
+ variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 gcc48 \
+ description {Use the gcc45 compiler (enables fortran linking)} {
+ configure.compiler macports-gcc-4.5
+ }
+
+ variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 gcc48 \
+ description {Use the gcc46 compiler (enables fortran linking)} {
+ configure.compiler macports-gcc-4.6
+ }
+
+ variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 gcc48 \
+ description {Use the gcc47 compiler (enables fortran linking)} {
+ configure.compiler macports-gcc-4.7
+ }
+
+ variant gcc48 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 \
+ description {Use the gcc48 compiler (enables fortran linking)} {
+ configure.compiler macports-gcc-4.8
+ }
+
+ if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset gcc48]} {
+ default_variants +gcc47
+ }
+
+ if {[variant_isset gcc43]} {
+ set gcc_version "4.3"
+ } elseif {[variant_isset gcc44]} {
+ set gcc_version "4.4"
+ } elseif {[variant_isset gcc45]} {
+ set gcc_version "4.5"
+ } elseif {[variant_isset gcc46]} {
+ set gcc_version "4.6"
+ } elseif {[variant_isset gcc47]} {
+ set gcc_version "4.7"
+ } elseif {[variant_isset gcc48]} {
+ set gcc_version "4.8"
+ }
+
+ # when using non-Apple GCC for universal install, it can
+ # create binaries only for the native OS architecture, at
+ # either 32 or 64 bits. Restrict the supported archs
+ # accordingly.
+ if {${os.arch} == "i386"} {
+ supported_archs i386 x86_64
+ } elseif {${os.arch} == "powerpc"} {
+ supported_archs ppc ppc64
+ }
+
+ # include all the correct GCC4X port
+ depends_lib-append port:gcc[join [split ${gcc_version} "."] ""]
+
+ # force LDFLAGS for correct linking of the linalg module
+ # for non-Apple GCC compilers
+ patchfiles-append patch-numpy_linalg_setup.py.diff
+
+ if {${gcc_version} == ""} {
+ # user specified -gcc4X but +atlas (either as default or
+ # explicitly); do not allow since it might lead to
+ # undetermined runtime execution.
+ return -code error \
+"\n\nWhen using the +atlas variant (either as the default or setting
+explicitly), one of the +gcc4X variants must be selected.\n"
+ }
+
+ } else {
+ variant universal {
+ patchfiles-append patch-setup.py.diff
+ }
+ }
+
+ post-patch {
+ reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \
+ ${worksrcpath}/numpy/f2py/setup.py
+
+ if {[variant_isset universal] && [variant_isset atlas]} {
+ # Prepare wrappers
+ file copy -force ${filespath}/wrapper-template \
+ ${worksrcpath}/c-wrapper
+ file copy -force ${filespath}/wrapper-template \
+ ${worksrcpath}/f-wrapper
+ file copy -force ${filespath}/wrapper-template \
+ ${worksrcpath}/cxx-wrapper
+
+ reinplace "s|@@@|${configure.cc}|" ${worksrcpath}/c-wrapper
+ reinplace "s|---|\\\\.c|" ${worksrcpath}/c-wrapper
+ reinplace "s|&&&|${prefix}|" ${worksrcpath}/c-wrapper
+
+ reinplace "s|@@@|${configure.cxx}|" ${worksrcpath}/cxx-wrapper
+ reinplace "s#---#(\\\\.C|\\\\.cpp|\\\\.cc)#" \
+ ${worksrcpath}/cxx-wrapper
+ reinplace "s|&&&|${prefix}|" ${worksrcpath}/cxx-wrapper
+
+ reinplace "s|@@@|${configure.f90}|" ${worksrcpath}/f-wrapper
+ reinplace "s|---|\\\\.f|" ${worksrcpath}/f-wrapper
+ reinplace "s|&&&|${prefix}|" ${worksrcpath}/f-wrapper
+
+ build.env-append CC="${worksrcpath}/c-wrapper" \
+ CXX="${worksrcpath}/cxx-wrapper" \
+ F77="${worksrcpath}/f-wrapper" \
+ F90="${worksrcpath}/f-wrapper"
+
+ destroot.env-append CC="${worksrcpath}/c-wrapper" \
+ CXX="${worksrcpath}/cxx-wrapper" \
+ F77="${worksrcpath}/f-wrapper" \
+ F90="${worksrcpath}/f-wrapper"
+ }
+
+ if {[variant_isset atlas]} {
+ # We must link against libSatlas or libTatlas, not libAtlas
+ if {[file exists ${prefix}/lib/libtatlas.dylib]} {
+ reinplace -E \
+ "s|_lib_atlas = \\\['atlas'\\\]|_lib_atlas = \\\['tatlas'\\\]|" \
+ ${worksrcpath}/numpy/distutils/system_info.py
+ } elseif {[file exists ${prefix}/lib/libsatlas.dylib]} {
+ reinplace -E \
+ "s|_lib_atlas = \\\['atlas'\\\]|_lib_atlas = \\\['satlas'\\\]|" \
+ ${worksrcpath}/numpy/distutils/system_info.py
+ } else {
+ return -code error "Unable to find Atlas dylibs. Bailing out."
+ }
+ }
+ }
+
+ livecheck.type none
+#} else {
+# livecheck.regex archive/[join ${github.tag_prefix} ""](\[\\d+(?:\\.\\d+)*"\]+)${extract.suffix}"
+}
diff --git a/packaging/macosx/ports/python/py25-numpy/files/patch-f2py_setup.py.diff b/packaging/macosx/ports/python/py25-numpy/files/patch-f2py_setup.py.diff
new file mode 100644
index 000000000..5b8f2a28f
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-numpy/files/patch-f2py_setup.py.diff
@@ -0,0 +1,29 @@
+--- numpy/f2py/setup.py.orig 2013-02-10 00:51:36.000000000 +0400
++++ numpy/f2py/setup.py 2013-03-19 15:27:15.000000000 +0400
+@@ -41,7 +41,7 @@
+ config.make_svn_version_py()
+
+ def generate_f2py_py(build_dir):
+- f2py_exe = 'f2py'+os.path.basename(sys.executable)[6:]
++ f2py_exe = 'f2py'
+ if f2py_exe[-4:]=='.exe':
+ f2py_exe = f2py_exe[:-4] + '.py'
+ if 'bdist_wininst' in sys.argv and f2py_exe[-3:] != '.py':
+@@ -51,7 +51,7 @@
+ log.info('Creating %s', target)
+ f = open(target,'w')
+ f.write('''\
+-#!/usr/bin/env %s
++#!@@MPORTS_PYTHON@@
+ # See http://cens.ioc.ee/projects/f2py2e/
+ import os, sys
+ for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]:
+@@ -75,7 +75,7 @@
+ sys.stderr.write("Unknown mode: " + repr(mode) + "\\n")
+ sys.exit(1)
+ main()
+-'''%(os.path.basename(sys.executable)))
++''')
+ f.close()
+ return target
+
diff --git a/packaging/macosx/ports/python/py25-numpy/files/patch-fcompiler_g95.diff b/packaging/macosx/ports/python/py25-numpy/files/patch-fcompiler_g95.diff
new file mode 100644
index 000000000..2640a530b
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-numpy/files/patch-fcompiler_g95.diff
@@ -0,0 +1,11 @@
+--- numpy/distutils/fcompiler/__init__.py.orig 2013-03-19 13:35:03.000000000 +0400
++++ numpy/distutils/fcompiler/__init__.py 2013-03-19 13:35:27.000000000 +0400
+@@ -708,7 +708,7 @@
+ ('cygwin.*', ('gnu','intelv','absoft','compaqv','intelev','gnu95','g95')),
+ ('linux.*', ('gnu95','intel','lahey','pg','absoft','nag','vast','compaq',
+ 'intele','intelem','gnu','g95','pathf95')),
+- ('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg')),
++ ('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'pg')),
+ ('sunos.*', ('sun','gnu','gnu95','g95')),
+ ('irix.*', ('mips','gnu','gnu95',)),
+ ('aix.*', ('ibm','gnu','gnu95',)),
diff --git a/packaging/macosx/ports/python/py25-numpy/files/patch-numpy_distutils_fcompiler___init__.py.diff b/packaging/macosx/ports/python/py25-numpy/files/patch-numpy_distutils_fcompiler___init__.py.diff
new file mode 100644
index 000000000..4f73dcfc9
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-numpy/files/patch-numpy_distutils_fcompiler___init__.py.diff
@@ -0,0 +1,30 @@
+--- numpy/distutils/fcompiler/__init__.py.orig 2013-10-31 13:24:12.000000000 +0400
++++ numpy/distutils/fcompiler/__init__.py 2013-10-31 13:45:03.000000000 +0400
+@@ -815,7 +815,7 @@
+ return compiler_type
+
+ # Flag to avoid rechecking for Fortran compiler every time
+-failed_fcompiler = False
++failed_fcompilers = []
+
+ def new_fcompiler(plat=None,
+ compiler=None,
+@@ -828,7 +828,8 @@
+ platform/compiler combination.
+ """
+ global failed_fcompiler
+- if failed_fcompiler:
++ fcompiler_key = (plat, compiler)
++ if fcompiler_key in failed_fcompilers:
+ return None
+
+ load_all_fcompiler_classes()
+@@ -848,7 +849,7 @@
+ msg = msg + " Supported compilers are: %s)" \
+ % (','.join(fcompiler_class.keys()))
+ log.warn(msg)
+- failed_fcompiler = True
++ failed_fcompilers.append(fcompiler_key)
+ return None
+
+ compiler = klass(verbose=verbose, dry_run=dry_run, force=force)
diff --git a/packaging/macosx/ports/python/py25-numpy/files/patch-numpy_linalg_setup.py.diff b/packaging/macosx/ports/python/py25-numpy/files/patch-numpy_linalg_setup.py.diff
new file mode 100644
index 000000000..0b06883a4
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-numpy/files/patch-numpy_linalg_setup.py.diff
@@ -0,0 +1,10 @@
+--- numpy/linalg/setup.py.orig 2010-09-14 11:44:21.000000000 -0400
++++ numpy/linalg/setup.py 2010-09-14 11:45:01.000000000 -0400
+@@ -27,6 +27,7 @@
+ 'zlapack_lite.c', 'dlapack_lite.c',
+ 'blas_lite.c', 'dlamch.c',
+ 'f2c_lite.c','f2c.h'],
++ extra_link_args=['-undefined dynamic_lookup -bundle'],
+ extra_info = lapack_info
+ )
+
diff --git a/packaging/macosx/ports/python/py25-numpy/files/patch-setup.py.diff b/packaging/macosx/ports/python/py25-numpy/files/patch-setup.py.diff
new file mode 100644
index 000000000..04e3cdd7a
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-numpy/files/patch-setup.py.diff
@@ -0,0 +1,34 @@
+--- numpy/core/setup.py.orig 2009-04-05 04:09:20.000000000 -0400
++++ numpy/core/setup.py 2009-04-08 19:53:45.000000000 -0400
+@@ -309,7 +309,14 @@
+ if isinstance(d,str):
+ target_f.write('#define %s\n' % (d))
+ else:
+- target_f.write('#define %s %s\n' % (d[0],d[1]))
++ if d[0]!='SIZEOF_LONG' and d[0]!='SIZEOF_PY_INTPTR_T':
++ target_f.write('#define %s %s\n' % (d[0],d[1]))
++ else:
++ target_f.write('#ifdef __LP64__\n')
++ target_f.write('#define %s %s\n' % (d[0],8))
++ target_f.write('#else\n')
++ target_f.write('#define %s %s\n' % (d[0],4))
++ target_f.write('#endif\n')
+
+ # define inline to our keyword, or nothing
+ target_f.write('#ifndef __cplusplus\n')
+@@ -393,7 +393,14 @@
+ if isinstance(d,str):
+ target_f.write('#define %s\n' % (d))
+ else:
+- target_f.write('#define %s %s\n' % (d[0],d[1]))
++ if d[0]!='NPY_SIZEOF_LONG' and d[0]!='NPY_SIZEOF_PY_INTPTR_T':
++ target_f.write('#define %s %s\n' % (d[0],d[1]))
++ else:
++ target_f.write('#ifdef __LP64__\n')
++ target_f.write('#define %s %s\n' % (d[0],8))
++ target_f.write('#else\n')
++ target_f.write('#define %s %s\n' % (d[0],4))
++ target_f.write('#endif\n')
+
+ # define NPY_INLINE to recognized keyword
+ target_f.write('#define NPY_INLINE %s\n' % inline)
diff --git a/packaging/macosx/ports/python/py25-numpy/files/wrapper-template b/packaging/macosx/ports/python/py25-numpy/files/wrapper-template
new file mode 100755
index 000000000..48936d107
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-numpy/files/wrapper-template
@@ -0,0 +1,143 @@
+#!/bin/sh
+COMPILER='@@@'
+SUFFIX='---'
+PREFIX='&&&'
+OUTPUT_O='NO'
+OUTPUT=''
+NAMED_OUTPUT=''
+LASTFILE=''
+INTEL='NO'
+SIZE32='NO'
+SIZE64='NO'
+NEWARGS=''
+
+SKIP='NO'
+
+for arg in $@
+do
+ if [ $SKIP = 'ARCH' ]; then
+ # intercept -arch option and set SIZEXX
+ SKIP='NO'
+ if [ $arg = 'x86_64' ] || [ $arg = 'ppc64' ]; then
+ SIZE64='YES'
+ else
+ SIZE32='YES'
+ fi
+
+ # which architecture are we compiling for?
+ if [ $arg = 'x86_64' ] || [ $arg = 'i386' ]; then
+ INTEL='YES'
+ fi
+
+ elif [ $arg = '-arch' ]; then
+ SKIP='ARCH'
+
+ elif [ $arg = '--version' ]; then
+ ${COMPILER} --version
+ exit 0
+
+ else
+ NEWARGS+="$arg "
+
+ # if the -c option is given, the output is .o
+ if [ $arg = '-c' ]; then
+ OUTPUT_O='YES'
+ fi
+
+ # if the output file is given by a -o option, record it
+ if [ $SKIP = 'O' ]; then
+ SKIP='NO'
+ NAMED_OUTPUT=$arg
+ fi
+
+ if [ $arg = '-o' ]; then
+ SKIP='O'
+ fi
+
+ # Note each file ending by ${SUFFIX} and remember the last one
+ # Transform them in .o
+ if `echo $arg | grep -q "${SUFFIX}$"`; then
+ LASTFILE=$arg
+ OUTPUT+=`echo $arg | sed "s/${SUFFIX}/\.o/"`
+ OUTPUT+=' '
+ fi
+ fi
+done
+
+# What is the output?
+
+if [ ${NAMED_OUTPUT}"X" != "X" ]; then
+ OUTPUT=$NAMED_OUTPUT
+
+elif [ $OUTPUT_O = 'NO' ]; then
+ # It is an executable whose is name is the LASTFILE without suffix
+ OUTPUT=`echo ${LASTFILE} | sed "s/${SUFFIX}//"`
+fi
+
+# Othewise, the output is just the ${OUTPUT} variable as computed before
+
+# For some reason, -dynamiclib and -lpython2.6 are missing when linking
+# .so files. Add them, except if -bundle is set (incompatible switches)
+if [ `echo $OUTPUT | sed -E 's|.*\.||'` = "so" ] && \
+ ! `echo $NEWARGS | grep -q bundle`; then
+ NEWARGS="${NEWARGS} ${PREFIX}/lib/libpython2.6.dylib -dynamiclib"
+fi
+
+# Now, compile
+
+if [ $SIZE32 = 'NO' ] && [ $SIZE64 = 'NO' ]; then
+ # No size indication given, just proceed with default
+ if `${COMPILER} $NEWARGS`; then
+ exit 0
+ else
+ exit 1
+ fi
+
+elif [ $SIZE32 = 'YES' ] && [ $SIZE64 = 'NO' ]; then
+ # 32-bit
+ if `${COMPILER} -m32 $NEWARGS`; then
+ exit 0
+ else
+ exit 1
+ fi
+
+elif [ $SIZE32 = 'NO' ] && [ $SIZE64 = 'YES' ]; then
+ # 64-bit
+ if `${COMPILER} -m64 $NEWARGS`; then
+ exit 0
+ else
+ exit 1
+ fi
+
+else
+ # Universal case
+ if `${COMPILER} -m32 $NEWARGS`; then
+ for filename in ${OUTPUT}
+ do
+ mv ${filename} ${filename}.32
+ done
+
+ if `${COMPILER} -m64 $NEWARGS`; then
+ for filename in ${OUTPUT}
+ do
+ mv ${filename} ${filename}.64
+ if [ $INTEL = 'YES' ]; then
+ lipo -create -arch x86_64 ${filename}.64 \
+ -arch i386 ${filename}.32 \
+ -output ${filename}
+ else
+ lipo -create -arch ppc64 ${filename}.64 \
+ -arch ppc ${filename}.32 \
+ -output ${filename}
+ fi
+
+ rm -f ${filename}.32 ${filename}.64
+ done
+ else
+ exit 1
+ fi
+ else
+ exit 1
+ fi
+fi
+exit 0
diff --git a/packaging/macosx/ports/python/py25-setuptools/Portfile b/packaging/macosx/ports/python/py25-setuptools/Portfile
new file mode 100644
index 000000000..35c528500
--- /dev/null
+++ b/packaging/macosx/ports/python/py25-setuptools/Portfile
@@ -0,0 +1,58 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id: Portfile 123950 2014-08-16 14:24:07Z jmr@macports.org $
+
+PortSystem 1.0
+PortGroup python 1.0
+
+name py25-setuptools
+version 5.7
+categories-append devel
+license {PSF ZPL}
+maintainers jmr openmaintainer
+description distutils enhancement for build and distribution
+long_description \
+ setuptools is a collection of enhancements to the Python distutils that \
+ allow you to more easily build and distribute Python packages, \
+ especially ones that have dependencies on other packages.
+
+platforms darwin
+supported_archs noarch
+
+homepage https://pypi.python.org/pypi/setuptools/
+master_sites https://pypi.python.org/packages/source/s/setuptools/
+distname setuptools-${version}
+
+checksums md5 81f980854a239d60d074d6ba052e21ed \
+ rmd160 ee9eff6c77e6f27e22e2049a6685bb0e624f94b0 \
+ sha256 a8bbdb2d67532c5b5cef5ba09553cea45d767378e42c7003347e53ebbe70f482
+
+python.versions 25
+python.link_binaries no
+python.move_binaries no
+
+if {$subport eq $name} {
+ if {${python.version} == 25} {
+ version 1.4.2
+ revision 100
+ distname setuptools-${version}
+ checksums md5 13951be6711438073fbe50843e7f141f \
+ rmd160 b48086a2aae718fe433a8c882d2d9209aa157b0a \
+ sha256 263986a60a83aba790a5bffc7d009ac88114ba4e908e5c90e453b3bf2155dbbd
+ }
+
+ post-destroot {
+ xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport}
+ xinstall -m 644 -W ${worksrcpath} CHANGES.txt \
+ DEVGUIDE.txt README.txt ${destroot}${prefix}/share/doc/${subport}
+ if {${python.version} <= 25} {
+ delete "${destroot}${prefix}/bin/easy_install"
+ } else {
+ ln -s "${python.prefix}/bin/easy_install-${python.branch}" "${destroot}${prefix}/bin/"
+ }
+ }
+ livecheck.type none
+#} else {
+# livecheck.type regex
+# livecheck.url ${homepage}
+# livecheck.regex setuptools/(\\d+(\\.\\d+)+)
+}