NON-WORKING python with an older version of the MinGW patch.
authorRichard W.M. Jones <rjones@redhat.com>
Tue, 7 Oct 2008 12:28:05 +0000 (13:28 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 7 Oct 2008 12:28:05 +0000 (13:28 +0100)
30 files changed:
.hgignore
python/Python-2.2.1-pydocnogui.patch [new file with mode: 0644]
python/mingw32-python-2.5.2-cross.patch-20081006 [new file with mode: 0644]
python/mingw32-python.spec [new file with mode: 0644]
python/python-2.3.4-lib64-regex.patch [new file with mode: 0644]
python/python-2.3.4-pydocnodoc.patch [new file with mode: 0644]
python/python-2.4.1-canonicalize.patch [new file with mode: 0644]
python/python-2.5-CVE-2008-2316.patch [new file with mode: 0644]
python/python-2.5-cflags.patch [new file with mode: 0644]
python/python-2.5-config.patch [new file with mode: 0644]
python/python-2.5-disable-egginfo.patch [new file with mode: 0644]
python/python-2.5-lib64.patch [new file with mode: 0644]
python/python-2.5-tkinter.patch [new file with mode: 0644]
python/python-2.5-xmlrpclib-marshal-objects.patch [new file with mode: 0644]
python/python-2.5.1-binutils-no-dep.patch [new file with mode: 0644]
python/python-2.5.1-codec-ascii-tolower.patch [new file with mode: 0644]
python/python-2.5.1-ctypes-exec-stack.patch [new file with mode: 0644]
python/python-2.5.1-db46.patch [new file with mode: 0644]
python/python-2.5.1-db47.patch [new file with mode: 0644]
python/python-2.5.1-listdir.patch [new file with mode: 0644]
python/python-2.5.1-plural-fix.patch [new file with mode: 0644]
python/python-2.5.1-pysqlite.patch [new file with mode: 0644]
python/python-2.5.1-socketmodule-constants.patch [new file with mode: 0644]
python/python-2.5.1-socketmodule-constants2.patch [new file with mode: 0644]
python/python-2.5.1-sqlite-encoding.patch [new file with mode: 0644]
python/python-2.5.2-binutils-no-dep.patch [new file with mode: 0644]
python/python-2.5.2-db47.patch [new file with mode: 0644]
python/python-2.5.2-set_wakeup_fd4.patch [new file with mode: 0644]
python/python-2.5.CVE-2007-4965-int-overflow.patch [new file with mode: 0644]
python/python2.6-set_wakeup_fd4.patch [new file with mode: 0644]

index f72c261..1cc3815 100644 (file)
--- a/.hgignore
+++ b/.hgignore
@@ -42,6 +42,7 @@ pdcurses/PDCurses-3.4.tar.gz
 pixman/pixman-0.11.10.tar.gz
 pixman/pixman-0.12.0.tar.gz
 portablexdr/portablexdr-4.0.10.tar.gz
+python/Python-2.5.2.tar.bz2
 readline/readline-5.2.tar.gz
 runtime-bootstrap/mingw-runtime-3.14.tar.gz
 runtime/mingw-runtime-3.14-src.tar.gz
diff --git a/python/Python-2.2.1-pydocnogui.patch b/python/Python-2.2.1-pydocnogui.patch
new file mode 100644 (file)
index 0000000..da22ac3
--- /dev/null
@@ -0,0 +1,37 @@
+--- Python-2.2.1/Lib/pydoc.py.nogui    2002-07-08 18:32:47.000000000 -0400
++++ Python-2.2.1/Lib/pydoc.py  2002-07-08 18:33:37.000000000 -0400
+@@ -18,9 +18,6 @@
+ Run "pydoc -p <port>" to start an HTTP server on a given port on the
+ local machine to generate documentation web pages.
+-For platforms without a command line, "pydoc -g" starts the HTTP server
+-and also pops up a little window for controlling it.
+-
+ Run "pydoc -w <name>" to write out the HTML documentation for a module
+ to a file named "<name>.html".
+ """
+@@ -2043,9 +2040,6 @@
+         writing = 0
+         for opt, val in opts:
+-            if opt == '-g':
+-                gui()
+-                return
+             if opt == '-k':
+                 apropos(val)
+                 return
+@@ -2099,13 +2093,10 @@
+ %s -p <port>
+     Start an HTTP server on the given port on the local machine.
+-%s -g
+-    Pop up a graphical interface for finding and serving documentation.
+-
+ %s -w <name> ...
+     Write out the HTML documentation for a module to a file in the current
+     directory.  If <name> contains a '%s', it is treated as a filename; if
+     it names a directory, documentation is written for all the contents.
+-""" % (cmd, os.sep, cmd, cmd, cmd, cmd, os.sep)
++""" % (cmd, os.sep, cmd, cmd, cmd, os.sep)
+  if __name__ == '__main__': cli()
diff --git a/python/mingw32-python-2.5.2-cross.patch-20081006 b/python/mingw32-python-2.5.2-cross.patch-20081006
new file mode 100644 (file)
index 0000000..e389235
--- /dev/null
@@ -0,0 +1,2135 @@
+diff -urN Python-2.5.2.orig/configure.in Python-2.5.2.mingw32/configure.in
+--- Python-2.5.2.orig/configure.in     2008-10-06 14:54:18.000000000 +0100
++++ Python-2.5.2.mingw32/configure.in  2008-10-06 18:31:53.000000000 +0100
+@@ -9,6 +9,11 @@
+ AC_CONFIG_SRCDIR([Include/object.h])
+ AC_CONFIG_HEADER(pyconfig.h)
++# find compiler while respecting --host setting
++AC_CANONICAL_HOST()
++AC_CHECK_TOOLS(CC,gcc cc)
++AC_CHECK_TOOLS(CXX,g++ c++)
++
+ dnl This is for stuff that absolutely must end up in pyconfig.h.
+ dnl Please use pyport.h instead, if possible.
+ AH_TOP([
+@@ -163,8 +168,8 @@
+ # Set name for machine-dependent library files
+ AC_SUBST(MACHDEP)
+ AC_MSG_CHECKING(MACHDEP)
+-if test -z "$MACHDEP"
+-then
++if test -z "$MACHDEP"; then
++    if test "$cross_compiling" = "no"; then
+       ac_sys_system=`uname -s`
+       if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
+       -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
+@@ -172,6 +177,23 @@
+       else
+               ac_sys_release=`uname -r`
+       fi
++    else
++      m=`$CC -dumpmachine`
++      changequote(<<, >>)#dnl
++      ac_sys_system=`expr "$m" : "[^-]*-\([^-]*\)"`
++      changequote([, ])#dnl
++
++
++      case $ac_sys_system in
++      cygwin*) ac_sys_system=`echo $ac_sys_system | sed s/cygwin/CYGWIN/g `;;
++      darwin*) ac_sys_system=`echo $ac_sys_system | sed s/darwin/Darwin/g `;;
++      freebsd*) ac_sys_system=`echo $ac_sys_system | sed s/freebsd/FreeBSD/g `;;
++      linux*) ac_sys_system=`echo $ac_sys_system | sed s/linux/Linux/g `;;
++      esac
++      
++
++    fi
++    
+       ac_md_system=`echo $ac_sys_system |
+                          tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
+       ac_md_release=`echo $ac_sys_release |
+@@ -424,8 +446,8 @@
+ if test -z "$CXX"
+ then
+         case "$CC" in
+-        gcc)    AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
+-        cc)     AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
++        gcc)    AC_CHECK_TOOL(CXX, [g++], [notfound]) ;;
++        cc)     AC_CHECK_TOOL(CXX, [c++], [notfound]) ;;
+         esac
+       if test "$CXX" = "notfound"
+       then
+@@ -434,7 +456,7 @@
+ fi
+ if test -z "$CXX"
+ then
+-      AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
++      AC_CHECK_TOOLS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
+       if test "$CXX" = "notfound"
+       then
+               CXX=""
+@@ -462,34 +484,6 @@
+ esac
+ AC_EXEEXT
+-AC_MSG_CHECKING(for --with-suffix)
+-AC_ARG_WITH(suffix,
+-            AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
+-[
+-      case $withval in
+-      no)     EXEEXT=;;
+-      yes)    EXEEXT=.exe;;
+-      *)      EXEEXT=$withval;;
+-      esac])
+-AC_MSG_RESULT($EXEEXT)
+-
+-# Test whether we're running on a non-case-sensitive system, in which
+-# case we give a warning if no ext is given
+-AC_SUBST(BUILDEXEEXT)
+-AC_MSG_CHECKING(for case-insensitive build directory)
+-if test ! -d CaseSensitiveTestDir; then
+-mkdir CaseSensitiveTestDir
+-fi
+-
+-if test -d casesensitivetestdir
+-then
+-    AC_MSG_RESULT(yes)
+-    BUILDEXEEXT=.exe
+-else
+-      AC_MSG_RESULT(no)
+-      BUILDEXEEXT=$EXEEXT
+-fi
+-rmdir CaseSensitiveTestDir
+ case $MACHDEP in
+ bsdos*)
+@@ -686,9 +680,9 @@
+ AC_MSG_RESULT($LDLIBRARY)
+-AC_PROG_RANLIB
+-AC_SUBST(AR)
+-AC_CHECK_PROGS(AR, ar aal, ar)
++# find tools while respecting --host setting
++AC_CHECK_TOOL(RANLIB,ranlib)
++AC_CHECK_TOOLS(AR,ar aal,ar)
+ AC_SUBST(SVNVERSION)
+ AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
+@@ -810,7 +804,7 @@
+      AC_TRY_RUN([int main() { return 0; }],
+      ac_cv_no_strict_aliasing_ok=yes,
+      ac_cv_no_strict_aliasing_ok=no,
+-     ac_cv_no_strict_aliasing_ok=no)
++     ac_cv_no_strict_aliasing_ok=yes)
+      CC="$ac_save_cc"
+     AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
+     if test $ac_cv_no_strict_aliasing_ok = yes
+@@ -3369,27 +3363,15 @@
+   AC_MSG_RESULT(no)
+ )
+-AC_MSG_CHECKING(for /dev/ptmx)
+-
+-if test -r /dev/ptmx
+-then
+-  AC_MSG_RESULT(yes)
+-  AC_DEFINE(HAVE_DEV_PTMX, 1,
+-  [Define if we have /dev/ptmx.])
+-else
+-  AC_MSG_RESULT(no)
+-fi
+-
+-AC_MSG_CHECKING(for /dev/ptc)
+-
+-if test -r /dev/ptc
+-then
+-  AC_MSG_RESULT(yes)
+-  AC_DEFINE(HAVE_DEV_PTC, 1,
+-  [Define if we have /dev/ptc.])
+-else
+-  AC_MSG_RESULT(no)
+-fi
++AC_CHECK_FILE(/dev/ptmx,
++       [AC_DEFINE(HAVE_DEV_PTMX, 1,
++          [Define if we have /dev/ptmx.])],
++       [])
++ 
++AC_CHECK_FILE(/dev/ptc,
++       [AC_DEFINE(HAVE_DEV_PTC, 1,
++          [Define if we have /dev/ptc.])],
++       [])
+ case $MACHDEP in
+ darwin)       
+@@ -3411,7 +3393,8 @@
+ AC_MSG_CHECKING(for %zd printf() format support)
+-AC_TRY_RUN([#include <stdio.h>
++AC_CACHE_VAL(ac_cv_printf_zd_format,
++      AC_TRY_RUN([#include <stdio.h>
+ #include <stddef.h>
+ #include <string.h>
+@@ -3447,7 +3430,7 @@
+ }],
+ [AC_MSG_RESULT(yes)
+  AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
+- AC_MSG_RESULT(no))
++ AC_MSG_RESULT(no)))
+ AC_CHECK_TYPE(socklen_t,,
+   AC_DEFINE(socklen_t,int,
+@@ -3477,10 +3460,76 @@
+ done
+ AC_MSG_RESULT(done)
++# Cross compiling
++AC_SUBST(cross_compiling)
++
++if test "$cross_compiling" = "yes"; then
++    AC_MSG_CHECKING(cc for build)
++    CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
++else
++    CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
++fi   
++     
++if test "$cross_compiling" = "yes"; then
++   AC_MSG_RESULT($CC_FOR_BUILD)
++fi
++
++AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler (default: cc)])
++      
++if test "$cross_compiling" = "yes"; then
++    AC_MSG_CHECKING(python for build)
++    PYTHON_FOR_BUILD="${PYTHON_FOR_BUILD-python}"
++    PYTHON_FOR_BUILD=`which $PYTHON_FOR_BUILD`
++else
++    PYTHON_FOR_BUILD='./$(BUILDPYTHON)'
++fi   
++
++if test "$cross_compiling" = "yes"; then
++    AC_MSG_RESULT($PYTHON_FOR_BUILD)
++fi
++AC_ARG_VAR(PYTHON_FOR_BUILD,[build system python (default: python)])
++AC_SUBST(PYTHON_FOR_BUILD)
++
++if test "$cross_compiling" = "yes"; then
++    CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-}
++    CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD- -I.}
++    CROSS_COMMENT=#
++    LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-}
++    O_FOR_BUILD=x
++    RUNSHARED="MACHDEP=$ac_sys_system SRCDIR=$srcdir SO=${SO}"
++
++    # Extra flags for MinGW host.
++    case "$host" in
++        *-*-mingw*)
++          CFLAGSFORSHARED="-I`pwd`/PC $CFLAGSFORSHARED"
++          CFLAGS_FOR_BUILD="-I`pwd`/PC $CFLAGS_FOR_BUILD"
++          CPPFLAGS_FOR_BUILD="-I`pwd`/PC $CPPFLAGS_FOR_BUILD" ;;
++    esac
++else
++    CROSS_COMMENT=
++    O_FOR_BUILD=o
++fi
++AC_SUBST(CFLAGS_FOR_BUILD)
++AC_SUBST(CPPFLAGS_FOR_BUILD)
++AC_SUBST(CROSS_COMMENT)
++AC_SUBST(LDFLAGS_FOR_BUILD)
++AC_SUBST(O_FOR_BUILD)
++
+ # generate output files
+ AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
+ AC_OUTPUT
++if test "$cross_compiling" = "yes"; then
++    case "$host" in
++        *-*-mingw*)
++          # Never use the generated pyconfig.h, always use the
++          # one in the PC/ subdirectory.
++          rm -f pyconfig.h pyconfig.h-t
++          echo '#include "PC/pyconfig.h"' > pyconfig.h-t
++          mv pyconfig.h-t pyconfig.h
++    esac
++fi
++
+ echo "creating Modules/Setup"
+ if test ! -f Modules/Setup
+ then
+diff -urN Python-2.5.2.orig/Include/pyport.h Python-2.5.2.mingw32/Include/pyport.h
+--- Python-2.5.2.orig/Include/pyport.h 2008-02-14 11:26:18.000000000 +0000
++++ Python-2.5.2.mingw32/Include/pyport.h      2008-10-06 15:07:45.000000000 +0100
+@@ -752,6 +752,7 @@
+ #define LONG_BIT (8 * SIZEOF_LONG)
+ #endif
++#ifndef __MINGW32__
+ #if LONG_BIT != 8 * SIZEOF_LONG
+ /* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent
+  * 32-bit platforms using gcc.  We try to catch that here at compile-time
+@@ -760,6 +761,7 @@
+  */
+ #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
+ #endif
++#endif
+ #ifdef __cplusplus
+ }
+diff -urN Python-2.5.2.orig/Lib/distutils/command/build_ext.py Python-2.5.2.mingw32/Lib/distutils/command/build_ext.py
+--- Python-2.5.2.orig/Lib/distutils/command/build_ext.py       2007-04-24 16:27:25.000000000 +0100
++++ Python-2.5.2.mingw32/Lib/distutils/command/build_ext.py    2008-10-06 14:55:15.000000000 +0100
+@@ -624,6 +624,8 @@
+             ext_path[len(ext_path) - 1] = ext_path[len(ext_path) - 1][:8]
+         # extensions in debug_mode are named 'module_d.pyd' under windows
+         so_ext = get_config_var('SO')
++        if os.environ.get('CROSS_COMPILING') == 'yes':
++            so_ext = os.environ.get('SO')
+         if os.name == 'nt' and self.debug:
+             return apply(os.path.join, ext_path) + '_d' + so_ext
+         return apply(os.path.join, ext_path) + so_ext
+@@ -705,6 +707,8 @@
+             return ext.libraries
+         else:
++            if os.environ.get('CROSS_COMPILING') == 'yes':
++                return []
+             from distutils import sysconfig
+             if sysconfig.get_config_var('Py_ENABLE_SHARED'):
+                 template = "python%d.%d"
+diff -urN Python-2.5.2.orig/Lib/plat-linux/regen Python-2.5.2.mingw32/Lib/plat-linux/regen
+--- Python-2.5.2.orig/Lib/plat-linux/regen     1970-01-01 01:00:00.000000000 +0100
++++ Python-2.5.2.mingw32/Lib/plat-linux/regen  2008-10-06 14:55:15.000000000 +0100
+@@ -0,0 +1,3 @@
++#! /bin/sh
++set -v
++python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
+diff -urN Python-2.5.2.orig/Makefile.pre.in Python-2.5.2.mingw32/Makefile.pre.in
+--- Python-2.5.2.orig/Makefile.pre.in  2008-10-06 14:54:19.000000000 +0100
++++ Python-2.5.2.mingw32/Makefile.pre.in       2008-10-06 18:31:47.000000000 +0100
+@@ -27,6 +27,7 @@
+ VERSION=      @VERSION@
+ srcdir=               @srcdir@
+ VPATH=                @srcdir@
++export srcdir
+ CC=           @CC@
+ CXX=          @CXX@
+@@ -72,6 +73,15 @@
+ # C flags used for building the interpreter object files
+ PY_CFLAGS=    $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
++# For cross compile: build compiler options
++CC_FOR_BUILD= @CC_FOR_BUILD@
++CROSS_COMPILING=      @cross_compiling@
++EXEEXT                =       @EXEEXT@
++O_FOR_BUILD=  @O_FOR_BUILD@
++
++CFLAGS_FOR_BUILD=     @CFLAGS_FOR_BUILD@
++CPPFLAGS_FOR_BUILD=   @CPPFLAGS_FOR_BUILD@ -I$(srcdir)/Include
++LDFLAGS_FOR_BUILD=    @LDFLAGS_FOR_BUILD@
+ # Machine-dependent subdirectories
+ MACHDEP=      @MACHDEP@
+@@ -108,7 +118,6 @@
+ # Executable suffix (.exe on Windows and Mac OS X)
+ EXE=          @EXEEXT@
+-BUILDEXE=     @BUILDEXEEXT@
+ # Short name and location for Mac OS X Python framework
+ UNIVERSALSDK=@UNIVERSALSDK@
+@@ -172,7 +181,8 @@
+ UNICODE_OBJS=   @UNICODE_OBJS@
+ PYTHON=               python$(EXE)
+-BUILDPYTHON=  python$(BUILDEXE)
++BUILDPYTHON=  python$(EXE)
++PYTHON_FOR_BUILD=     @PYTHON_FOR_BUILD@
+ # === Definitions added by makesetup ===
+@@ -198,7 +208,7 @@
+ ##########################################################################
+ # Parser
+-PGEN=         Parser/pgen$(EXE)
++PGEN_FOR_BUILD=       Parser/pgen$(EXEEXT)
+ POBJS=                \
+               Parser/acceler.o \
+@@ -215,14 +225,27 @@
+ PARSER_OBJS=  $(POBJS) Parser/myreadline.o Parser/tokenizer.o
+-PGOBJS=               \
+-              Objects/obmalloc.o \
+-              Python/mysnprintf.o \
+-              Parser/tokenizer_pgen.o \
+-              Parser/printgrammar.o \
+-              Parser/pgenmain.o
++POBJS_FOR_BUILD=              \
++              Parser/acceler.$(O_FOR_BUILD) \
++              Parser/grammar1.$(O_FOR_BUILD) \
++              Parser/listnode.$(O_FOR_BUILD) \
++              Parser/node.$(O_FOR_BUILD) \
++              Parser/parser.$(O_FOR_BUILD) \
++              Parser/parsetok.$(O_FOR_BUILD) \
++              Parser/bitset.$(O_FOR_BUILD) \
++              Parser/metagrammar.$(O_FOR_BUILD) \
++              Parser/firstsets.$(O_FOR_BUILD) \
++              Parser/grammar.$(O_FOR_BUILD) \
++              Parser/pgen.$(O_FOR_BUILD)
++
++PGOBJS_FOR_BUILD=             \
++              Objects/obmalloc.$(O_FOR_BUILD) \
++              Python/mysnprintf.$(O_FOR_BUILD) \
++              Parser/tokenizer_pgen.$(O_FOR_BUILD) \
++              Parser/printgrammar.$(O_FOR_BUILD) \
++              Parser/pgenmain.$(O_FOR_BUILD)
+-PGENOBJS=     $(PGENMAIN) $(POBJS) $(PGOBJS)
++PGENOBJS=     $(POBJS_FOR_BUILD) $(PGOBJS_FOR_BUILD)
+ ##########################################################################
+ # AST
+@@ -341,15 +364,18 @@
+                       Modules/python.o \
+                       $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+-platform: $(BUILDPYTHON)
+-      $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
+-
++platform: $(PYTHON_FOR_BUILD)
++      $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
+ # Build the shared modules
+-sharedmods: $(BUILDPYTHON)
++sharedmods: $(PYTHON_FOR_BUILD)
+       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) CROSS_COMPILING=$(CROSS_COMPILING) CC='$(CC)' \
++            CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
++            LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
++      *) $(RUNSHARED) CROSS_COMPILING=$(CROSS_COMPILING) CC='$(CC)' \
++            CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
++            LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
+       esac
+ # Build static library
+@@ -472,12 +498,12 @@
+       $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
+-$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
++$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT)
+               -@ mkdir Include
+-              -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
++              -$(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+-$(PGEN):      $(PGENOBJS)
+-              $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
++$(PGEN_FOR_BUILD):    $(PGENOBJS)
++              $(CC_FOR_BUILD) $(OPT) $(LDFLAGS_FOR_BUILD) $(PGENOBJS) $(LIBS) -o $(PGEN_FOR_BUILD)
+ Parser/grammar.o:     $(srcdir)/Parser/grammar.c \
+                               $(srcdir)/Include/token.h \
+@@ -504,6 +530,14 @@
+                               $(srcdir)/Objects/unicodetype_db.h
+ ############################################################################
++# Cross compile rules
++
++# .x is a native object file during cross-compile. 
++.SUFFIXES: .x 
++.c.x:
++      $(CC_FOR_BUILD) -c $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $<
++
++############################################################################
+ # Header files
+ PYTHON_HEADERS= \
+@@ -576,7 +610,7 @@
+ TESTOPTS=     -l $(EXTRATESTOPTS)
+ TESTPROG=     $(srcdir)/Lib/test/regrtest.py
+-TESTPYTHON=   $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
++TESTPYTHON=   $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -tt
+ test:         all platform
+               -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
+               -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
+@@ -597,7 +631,7 @@
+               -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
+               -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
+               $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
+-              $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
++              $(RUNSHARED) /usr/libexec/oah/translate $(PYTHON_FOR_BUILD) -E -tt $(TESTPROG) $(TESTOPTS) -uall
+ # Like testall, but with a single pass only
+@@ -725,7 +759,7 @@
+               distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
+               setuptools setuptools/command setuptools/tests setuptools.egg-info \
+               curses $(MACHDEPS)
+-libinstall:   $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR)
++libinstall: $(srcdir)/Lib/$(PLATDIR) $(PYTHON_FOR_BUILD)
+       @for i in $(SCRIPTDIR) $(LIBDEST); \
+       do \
+               if test ! -d $(DESTDIR)$$i; then \
+@@ -782,19 +816,19 @@
+       done
+       $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
+       PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
++              $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
+               -d $(LIBDEST) -f \
+               -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
+       PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
++              $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
+               -d $(LIBDEST) -f \
+               -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
++              $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
+               -d $(LIBDEST)/site-packages -f \
+               -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
++              $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
+               -d $(LIBDEST)/site-packages -f \
+               -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+@@ -805,7 +839,7 @@
+       export PATH; PATH="`pwd`:$$PATH"; \
+       export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
+       export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
+-      export EXE; EXE="$(BUILDEXE)"; \
++      export EXE; EXE="$(EXEEXT)"; \
+       cd $(srcdir)/Lib/$(PLATDIR); ./regen
+ # Install the include files
+@@ -894,8 +928,9 @@
+ # Install the dynamically loadable modules
+ # This goes into $(exec_prefix)
+ sharedinstall:
+-      $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+-              --prefix=$(prefix) \
++      CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING='$(CROSS_COMPILING)' \
++              $(RUNSHARED) $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
++              --prefix=$(prefix) \
+               --install-scripts=$(BINDIR) \
+               --install-platlib=$(DESTSHARED) \
+               --root=/$(DESTDIR)
+@@ -967,8 +1002,8 @@
+ # This installs a few of the useful scripts in Tools/scripts
+ scriptsinstall:
+-      SRCDIR=$(srcdir) $(RUNSHARED) \
+-      ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
++      $(RUNSHARED) \
++      $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
+       --prefix=$(prefix) \
+       --install-scripts=$(BINDIR) \
+       --root=/$(DESTDIR)
+@@ -1029,11 +1064,12 @@
+       find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
+ clobber: clean
+-      -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
++      -rm -f $(BUILDPYTHON) $(PGEN_FOR_BUILD) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
+               tags TAGS \
+               config.cache config.log pyconfig.h Modules/config.c
+       -rm -rf build platform
+       -rm -rf $(PYTHONFRAMEWORKDIR)
++      -rm -rf buildpython
+ # Make things extra clean, before making a distribution:
+ # remove all generated files, even Makefile[.pre]
+diff -urN Python-2.5.2.orig/Makefile.pre.in~ Python-2.5.2.mingw32/Makefile.pre.in~
+--- Python-2.5.2.orig/Makefile.pre.in~ 1970-01-01 01:00:00.000000000 +0100
++++ Python-2.5.2.mingw32/Makefile.pre.in~      2008-10-06 14:55:15.000000000 +0100
+@@ -0,0 +1,1135 @@
++# Top-level Makefile for Python
++#
++# As distributed, this file is called Makefile.pre.in; it is processed
++# into the real Makefile by running the script ./configure, which
++# replaces things like @spam@ with values appropriate for your system.
++# This means that if you edit Makefile, your changes get lost the next
++# time you run the configure script.  Ideally, you can do:
++#
++#     ./configure
++#     make
++#     make test
++#     make install
++#
++# If you have a previous version of Python installed that you don't
++# want to overwrite, you can use "make altinstall" instead of "make
++# install".  Refer to the "Installing" section in the README file for
++# additional details.
++#
++# See also the section "Build instructions" in the README file.
++
++# === Variables set by makesetup ===
++
++MODOBJS=        _MODOBJS_
++MODLIBS=        _MODLIBS_
++
++# === Variables set by configure
++VERSION=      @VERSION@
++srcdir=               @srcdir@
++VPATH=                @srcdir@
++export srcdir
++
++CC=           @CC@
++CXX=          @CXX@
++MAINCC=               @MAINCC@
++LINKCC=               @LINKCC@
++AR=           @AR@
++RANLIB=               @RANLIB@
++SVNVERSION=   @SVNVERSION@
++
++# Shell used by make (some versions default to the login shell, which is bad)
++SHELL=                /bin/sh
++
++# Use this to make a link between python$(VERSION) and python in $(BINDIR)
++LN=           @LN@
++
++# Portable install script (configure doesn't always guess right)
++INSTALL=      @INSTALL@
++INSTALL_PROGRAM=@INSTALL_PROGRAM@
++INSTALL_SCRIPT= @INSTALL_SCRIPT@
++INSTALL_DATA= @INSTALL_DATA@
++# Shared libraries must be installed with executable mode on some systems;
++# rather than figuring out exactly which, we always give them executable mode.
++# Also, making them read-only seems to be a good idea...
++INSTALL_SHARED= ${INSTALL} -m 555
++
++MAKESETUP=      $(srcdir)/Modules/makesetup
++
++# Compiler options
++OPT=          @OPT@
++BASECFLAGS=   @BASECFLAGS@
++CFLAGS=               $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
++# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
++# be able to build extension modules using the directories specified in the
++# environment variables
++CPPFLAGS=     -I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
++LDFLAGS=      @LDFLAGS@
++LDLAST=               @LDLAST@
++SGI_ABI=      @SGI_ABI@
++CCSHARED=     @CCSHARED@
++LINKFORSHARED=        @LINKFORSHARED@
++# Extra C flags added for building the interpreter object files.
++CFLAGSFORSHARED=@CFLAGSFORSHARED@
++# C flags used for building the interpreter object files
++PY_CFLAGS=    $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
++
++# For cross compile: build compiler options
++CC_FOR_BUILD= @CC_FOR_BUILD@
++CROSS_COMPILING=      @cross_compiling@
++EXEEXT_FOR_BUILD=     @EXEEXT_FOR_BUILD@
++O_FOR_BUILD=  @O_FOR_BUILD@
++
++CFLAGS_FOR_BUILD=     @CFLAGS_FOR_BUILD@
++CPPFLAGS_FOR_BUILD=   @CPPFLAGS_FOR_BUILD@ -I$(srcdir)/Include
++LDFLAGS_FOR_BUILD=    @LDFLAGS_FOR_BUILD@
++LIBS_FOR_BUILD=       @LIBS_FOR_BUILD@
++
++# Machine-dependent subdirectories
++MACHDEP=      @MACHDEP@
++
++# Install prefix for architecture-independent files
++prefix=               @prefix@
++
++# Install prefix for architecture-dependent files
++exec_prefix=  @exec_prefix@
++
++# Install prefix for data files
++datarootdir=    @datarootdir@
++
++# Expanded directories
++BINDIR=               $(exec_prefix)/bin
++LIBDIR=               $(exec_prefix)/lib64
++MANDIR=               @mandir@
++INCLUDEDIR=   @includedir@
++CONFINCLUDEDIR=       $(exec_prefix)/include
++SCRIPTDIR=    $(prefix)/lib64
++
++# Detailed destination directories
++BINLIBDEST=   $(LIBDIR)/python$(VERSION)
++LIBDEST=      $(SCRIPTDIR)/python$(VERSION)
++INCLUDEPY=    $(INCLUDEDIR)/python$(VERSION)
++CONFINCLUDEPY=        $(CONFINCLUDEDIR)/python$(VERSION)
++LIBP=         $(LIBDIR)/python$(VERSION)
++
++# Symbols used for using shared libraries
++SO=           @SO@
++LDSHARED=     @LDSHARED@
++BLDSHARED=    @BLDSHARED@
++DESTSHARED=   $(BINLIBDEST)/lib-dynload
++
++# Executable suffix (.exe on Windows and Mac OS X)
++EXE=          @EXEEXT@
++BUILDEXE=     @BUILDEXEEXT@
++
++# Short name and location for Mac OS X Python framework
++UNIVERSALSDK=@UNIVERSALSDK@
++PYTHONFRAMEWORK=      @PYTHONFRAMEWORK@
++PYTHONFRAMEWORKDIR=   @PYTHONFRAMEWORKDIR@
++PYTHONFRAMEWORKPREFIX=        @PYTHONFRAMEWORKPREFIX@
++PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
++# Deployment target selected during configure, to be checked
++# by distutils. The export statement is needed to ensure that the
++# deployment target is active during build.
++MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
++@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
++
++# Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
++OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
++
++# Environment to run shared python without installed libraries
++RUNSHARED=       @RUNSHARED@
++
++# Modes for directories, executables and data files created by the
++# install process.  Default to user-only-writable for all file types.
++DIRMODE=      755
++EXEMODE=      755
++FILEMODE=     644
++
++# configure script arguments
++CONFIG_ARGS=  @CONFIG_ARGS@
++
++
++# Subdirectories with code
++SRCDIRS=      @SRCDIRS@
++
++# Other subdirectories
++SUBDIRSTOO=   Include Lib Misc Demo
++
++# Files and directories to be distributed
++CONFIGFILES=  configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
++DISTFILES=    README ChangeLog $(CONFIGFILES)
++DISTDIRS=     $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
++DIST=         $(DISTFILES) $(DISTDIRS)
++
++
++LIBRARY=      @LIBRARY@
++LDLIBRARY=      @LDLIBRARY@
++BLDLIBRARY=     @BLDLIBRARY@
++DLLLIBRARY=   @DLLLIBRARY@
++LDLIBRARYDIR=   @LDLIBRARYDIR@
++INSTSONAME=   @INSTSONAME@
++
++
++LIBS=         @LIBS@
++LIBM=         @LIBM@
++LIBC=         @LIBC@
++SYSLIBS=      $(LIBM) $(LIBC)
++SHLIBS=               @SHLIBS@
++
++THREADOBJ=    @THREADOBJ@
++DLINCLDIR=    @DLINCLDIR@
++DYNLOADFILE=  @DYNLOADFILE@
++MACHDEP_OBJS= @MACHDEP_OBJS@
++UNICODE_OBJS=   @UNICODE_OBJS@
++
++PYTHON=               python$(EXE)
++BUILDPYTHON=  python$(EXE)
++PYTHON_FOR_BUILD=     @PYTHON_FOR_BUILD@
++
++# === Definitions added by makesetup ===
++
++
++##########################################################################
++# Modules
++MODULE_OBJS=  \
++              Modules/config.o \
++              Modules/getpath.o \
++              Modules/main.o \
++              Modules/gcmodule.o
++
++# Used of signalmodule.o is not available
++SIGNAL_OBJS=  @SIGNAL_OBJS@
++
++
++##########################################################################
++# Grammar
++GRAMMAR_H=    $(srcdir)/Include/graminit.h
++GRAMMAR_C=    $(srcdir)/Python/graminit.c
++GRAMMAR_INPUT=        $(srcdir)/Grammar/Grammar
++
++
++##########################################################################
++# Parser
++PGEN_FOR_BUILD=       Parser/pgen$(EXEEXT_FOR_BUILD)
++
++POBJS=                \
++              Parser/acceler.o \
++              Parser/grammar1.o \
++              Parser/listnode.o \
++              Parser/node.o \
++              Parser/parser.o \
++              Parser/parsetok.o \
++              Parser/bitset.o \
++              Parser/metagrammar.o \
++              Parser/firstsets.o \
++              Parser/grammar.o \
++              Parser/pgen.o
++
++PARSER_OBJS=  $(POBJS) Parser/myreadline.o Parser/tokenizer.o
++
++POBJS_FOR_BUILD=              \
++              Parser/acceler.$(O_FOR_BUILD) \
++              Parser/grammar1.$(O_FOR_BUILD) \
++              Parser/listnode.$(O_FOR_BUILD) \
++              Parser/node.$(O_FOR_BUILD) \
++              Parser/parser.$(O_FOR_BUILD) \
++              Parser/parsetok.$(O_FOR_BUILD) \
++              Parser/bitset.$(O_FOR_BUILD) \
++              Parser/metagrammar.$(O_FOR_BUILD) \
++              Parser/firstsets.$(O_FOR_BUILD) \
++              Parser/grammar.$(O_FOR_BUILD) \
++              Parser/pgen.$(O_FOR_BUILD)
++
++PGOBJS_FOR_BUILD=             \
++              Objects/obmalloc.$(O_FOR_BUILD) \
++              Python/mysnprintf.$(O_FOR_BUILD) \
++              Parser/tokenizer_pgen.$(O_FOR_BUILD) \
++              Parser/printgrammar.$(O_FOR_BUILD) \
++              Parser/pgenmain.$(O_FOR_BUILD)
++
++PGENOBJS=     $(POBJS_FOR_BUILD) $(PGOBJS_FOR_BUILD)
++
++##########################################################################
++# AST
++AST_H_DIR=    $(srcdir)/Include
++AST_H=                $(AST_H_DIR)/Python-ast.h
++AST_C_DIR=    $(srcdir)/Python
++AST_C=                $(AST_C_DIR)/Python-ast.c
++AST_ASDL=     $(srcdir)/Parser/Python.asdl
++
++ASDLGEN_FILES=        $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
++# XXX Note that a build now requires Python exist before the build starts
++ASDLGEN=      $(srcdir)/Parser/asdl_c.py
++
++##########################################################################
++# Python
++PYTHON_OBJS=  \
++              Python/Python-ast.o \
++              Python/asdl.o \
++              Python/ast.o \
++              Python/bltinmodule.o \
++              Python/ceval.o \
++              Python/compile.o \
++              Python/codecs.o \
++              Python/errors.o \
++              Python/frozen.o \
++              Python/frozenmain.o \
++              Python/future.o \
++              Python/getargs.o \
++              Python/getcompiler.o \
++              Python/getcopyright.o \
++              Python/getmtime.o \
++              Python/getplatform.o \
++              Python/getversion.o \
++              Python/graminit.o \
++              Python/import.o \
++              Python/importdl.o \
++              Python/marshal.o \
++              Python/modsupport.o \
++              Python/mystrtoul.o \
++              Python/mysnprintf.o \
++              Python/pyarena.o \
++              Python/pyfpe.o \
++              Python/pystate.o \
++              Python/pythonrun.o \
++              Python/structmember.o \
++              Python/symtable.o \
++              Python/sysmodule.o \
++              Python/traceback.o \
++              Python/getopt.o \
++              Python/pystrtod.o \
++              Python/$(DYNLOADFILE) \
++              $(MACHDEP_OBJS) \
++              $(THREADOBJ)
++
++
++##########################################################################
++# Objects
++OBJECT_OBJS=  \
++              Objects/abstract.o \
++              Objects/boolobject.o \
++              Objects/bufferobject.o \
++              Objects/cellobject.o \
++              Objects/classobject.o \
++              Objects/cobject.o \
++              Objects/codeobject.o \
++              Objects/complexobject.o \
++              Objects/descrobject.o \
++              Objects/enumobject.o \
++              Objects/exceptions.o \
++              Objects/genobject.o \
++              Objects/fileobject.o \
++              Objects/floatobject.o \
++              Objects/frameobject.o \
++              Objects/funcobject.o \
++              Objects/intobject.o \
++              Objects/iterobject.o \
++              Objects/listobject.o \
++              Objects/longobject.o \
++              Objects/dictobject.o \
++              Objects/methodobject.o \
++              Objects/moduleobject.o \
++              Objects/object.o \
++              Objects/obmalloc.o \
++              Objects/rangeobject.o \
++                Objects/setobject.o \
++              Objects/sliceobject.o \
++              Objects/stringobject.o \
++              Objects/structseq.o \
++              Objects/tupleobject.o \
++              Objects/typeobject.o \
++              Objects/weakrefobject.o \
++              $(UNICODE_OBJS)
++
++
++##########################################################################
++# objects that get linked into the Python library
++LIBRARY_OBJS= \
++              Modules/_typesmodule.o \
++              Modules/getbuildinfo.o \
++              $(PARSER_OBJS) \
++              $(OBJECT_OBJS) \
++              $(PYTHON_OBJS) \
++              $(MODULE_OBJS) \
++              $(SIGNAL_OBJS) \
++              $(MODOBJS)
++
++#########################################################################
++# Rules
++
++# Default target
++all:          $(BUILDPYTHON) oldsharedmods sharedmods
++
++# Build the interpreter
++$(BUILDPYTHON):       Modules/python.o $(LIBRARY) $(LDLIBRARY)
++              $(LINKCC) $(CFLAGS) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
++                      Modules/python.o \
++                      $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
++
++platform: $(PYTHON_FOR_BUILD)
++      $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
++
++# Build the shared modules
++sharedmods: $(PYTHON_FOR_BUILD)
++      case $$MAKEFLAGS in \
++      *-s*) $(RUNSHARED) CROSS_COMPILING=$(CROSS_COMPILING) CC='$(CC)' \
++            CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
++            LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py -q build;; \
++      *) $(RUNSHARED) CROSS_COMPILING=$(CROSS_COMPILING) CC='$(CC)' \
++            CFLAGS='$(CFLAGS) $(CPPFLAGS)' \
++            LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py build;; \
++      esac
++
++# Build static library
++# avoid long command lines, same as LIBRARY_OBJS
++$(LIBRARY): $(LIBRARY_OBJS)
++      -rm -f $@
++      $(AR) cr $@ Modules/getbuildinfo.o
++      $(AR) cr $@ Modules/_typesmodule.o
++      $(AR) cr $@ $(PARSER_OBJS)
++      $(AR) cr $@ $(OBJECT_OBJS)
++      $(AR) cr $@ $(PYTHON_OBJS)
++      $(AR) cr $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
++      $(AR) cr $@ $(MODOBJS)
++      $(RANLIB) $@
++
++libpython$(VERSION).so: $(LIBRARY_OBJS)
++      if test $(INSTSONAME) != $(LDLIBRARY); then \
++              $(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
++              $(LN) -f $(INSTSONAME) $@; \
++      else\
++              $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
++      fi
++
++libpython$(VERSION).sl: $(LIBRARY_OBJS)
++      $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
++
++# This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
++# minimal framework (not including the Lib directory and such) in the current
++# directory.
++RESSRCDIR=$(srcdir)/Mac/Resources/framework
++$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
++              $(LIBRARY) \
++              $(RESSRCDIR)/Info.plist \
++                $(RESSRCDIR)/version.plist \
++                $(RESSRCDIR)/English.lproj/InfoPlist.strings
++      $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
++      if test "${UNIVERSALSDK}"; then \
++              $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
++                      -isysroot "${UNIVERSALSDK}" \
++                      -all_load $(LIBRARY) -Wl,-single_module \
++                      -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \
++                      -compatibility_version $(VERSION) \
++                      -current_version $(VERSION); \
++        else \
++              /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
++                      @LIBTOOL_CRUFT@ ;\
++      fi
++      $(INSTALL) -d -m $(DIRMODE)  \
++              $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
++      $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
++              $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
++      $(INSTALL_DATA) $(RESSRCDIR)/version.plist \
++              $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist
++      $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
++              $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings
++      $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
++      $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
++      $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
++      $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
++
++# This rule builds the Cygwin Python DLL and import library if configured
++# for a shared core library; otherwise, this rule is a noop.
++$(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
++      if test -n "$(DLLLIBRARY)"; then \
++              $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
++                      $(LIBS) $(MODLIBS) $(SYSLIBS); \
++      else true; \
++      fi
++
++
++oldsharedmods: $(SHAREDMODS)
++
++
++Makefile Modules/config.c: Makefile.pre \
++                              $(srcdir)/Modules/config.c.in \
++                              $(MAKESETUP) \
++                              Modules/Setup.config \
++                              Modules/Setup \
++                              Modules/Setup.local
++      $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
++                              -s Modules \
++                              Modules/Setup.config \
++                              Modules/Setup.local \
++                              Modules/Setup
++      @mv config.c Modules
++      @echo "The Makefile was updated, you may need to re-run make."
++
++
++Modules/Setup: $(srcdir)/Modules/Setup.dist
++      @if test -f Modules/Setup; then \
++              echo "-----------------------------------------------"; \
++              echo "Modules/Setup.dist is newer than Modules/Setup;"; \
++              echo "check to make sure you have all the updates you"; \
++              echo "need in your Modules/Setup file."; \
++              echo "Usually, copying Setup.dist to Setup will work."; \
++              echo "-----------------------------------------------"; \
++      fi
++
++############################################################################
++# Special rules for object files
++
++Modules/getbuildinfo.o: $(PARSER_OBJS) \
++              $(OBJECT_OBJS) \
++              $(PYTHON_OBJS) \
++              $(MODULE_OBJS) \
++              $(SIGNAL_OBJS) \
++              $(MODOBJS) \
++              $(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)"' \
++              -DPREFIX='"$(prefix)"' \
++              -DEXEC_PREFIX='"$(exec_prefix)"' \
++              -DVERSION='"$(VERSION)"' \
++              -DVPATH='"$(VPATH)"' \
++              -o $@ $(srcdir)/Modules/getpath.c
++
++Modules/python.o: $(srcdir)/Modules/python.c
++      $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
++
++
++$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN_FOR_BUILD) $(GRAMMAR_INPUT)
++              -@ mkdir Include
++              -$(PGEN_FOR_BUILD) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
++
++$(PGEN_FOR_BUILD):    $(PGENOBJS)
++              $(CC_FOR_BUILD) $(OPT) $(LDFLAGS_FOR_BUILD) $(PGENOBJS) $(LIBS_FOR_BUILD) -o $(PGEN_FOR_BUILD)
++
++Parser/grammar.o:     $(srcdir)/Parser/grammar.c \
++                              $(srcdir)/Include/token.h \
++                              $(srcdir)/Include/grammar.h
++Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
++
++Parser/tokenizer_pgen.o:      $(srcdir)/Parser/tokenizer.c
++
++$(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
++      $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
++
++$(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
++      $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
++
++Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
++
++Python/getplatform.o: $(srcdir)/Python/getplatform.c
++              $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
++
++Python/importdl.o: $(srcdir)/Python/importdl.c
++              $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
++
++Objects/unicodectype.o:       $(srcdir)/Objects/unicodectype.c \
++                              $(srcdir)/Objects/unicodetype_db.h
++
++############################################################################
++# Cross compile rules
++
++# .x is a native object file during cross-compile. 
++.SUFFIXES: .x 
++.c.x:
++      $(CC_FOR_BUILD) -c $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $<
++
++############################################################################
++# Header files
++
++PYTHON_HEADERS= \
++              Include/Python.h \
++              Include/Python-ast.h \
++              Include/asdl.h \
++              Include/abstract.h \
++              Include/boolobject.h \
++              Include/bufferobject.h \
++              Include/ceval.h \
++              Include/classobject.h \
++              Include/cobject.h \
++              Include/code.h \
++              Include/codecs.h \
++              Include/compile.h \
++              Include/complexobject.h \
++              Include/descrobject.h \
++              Include/dictobject.h \
++              Include/enumobject.h \
++              Include/genobject.h \
++              Include/fileobject.h \
++              Include/floatobject.h \
++              Include/funcobject.h \
++              Include/import.h \
++              Include/intobject.h \
++              Include/intrcheck.h \
++              Include/iterobject.h \
++              Include/listobject.h \
++              Include/longobject.h \
++              Include/methodobject.h \
++              Include/modsupport.h \
++              Include/moduleobject.h \
++              Include/object.h \
++              Include/objimpl.h \
++              Include/patchlevel.h \
++              Include/pyarena.h \
++              Include/pydebug.h \
++              Include/pyerrors.h \
++              Include/pyfpe.h \
++              Include/pymem.h \
++              Include/pyport.h \
++              Include/pystate.h \
++              Include/pythonrun.h \
++              Include/rangeobject.h \
++                Include/setobject.h \
++              Include/sliceobject.h \
++              Include/stringobject.h \
++              Include/structseq.h \
++              Include/structmember.h \
++              Include/symtable.h \
++              Include/sysmodule.h \
++              Include/traceback.h \
++              Include/tupleobject.h \
++              Include/unicodeobject.h \
++              Include/weakrefobject.h \
++              pyconfig.h
++
++$(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
++
++
++######################################################################
++
++# Test the interpreter (twice, once without .pyc files, once with)
++# In the past, we've had problems where bugs in the marshalling or
++# elsewhere caused bytecode read from .pyc files to behave differently
++# than bytecode generated directly from a .py source file.  Sometimes
++# the bytecode read from a .pyc file had the bug, somtimes the directly
++# generated bytecode.  This is sometimes a very shy bug needing a lot of
++# sample data.
++
++TESTOPTS=     -l $(EXTRATESTOPTS)
++TESTPROG=     $(srcdir)/Lib/test/regrtest.py
++TESTPYTHON=   $(RUNSHARED) $(PYTHON_FOR_BUILD) -E -tt
++test:         all platform
++              -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
++              -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
++              $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
++
++testall:      all platform
++              -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
++              -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
++              $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
++
++#  Run the unitests for both architectures in a Universal build on OSX
++#  Must be run on an Intel box.
++testuniversal:        all platform
++              if [ `arch` != 'i386' ];then \
++                      echo "This can only be used on OSX/i386" ;\
++                      exit 1 ;\
++              fi
++              -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
++              -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
++              $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
++              $(RUNSHARED) /usr/libexec/oah/translate $(PYTHON_FOR_BUILD) -E -tt $(TESTPROG) $(TESTOPTS) -uall
++
++
++# Like testall, but with a single pass only
++# run an optional script to include some information about the build environment
++buildbottest: all platform
++              -@if which pybuildbot.identify >/dev/null 2>&1; then \
++                      pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
++              fi
++              $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
++
++QUICKTESTOPTS=        $(TESTOPTS) -x test_thread test_signal test_strftime \
++              test_unicodedata test_re test_sre test_select test_poll \
++              test_linuxaudiodev test_struct test_sunaudiodev test_zlib
++quicktest:    all platform
++              -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
++              -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
++              $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
++
++MEMTESTOPTS=    $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
++              test_longexp
++memtest:      all platform
++              -rm -f $(srcdir)/Lib/test/*.py[co]
++              -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
++              $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
++
++# Install everything
++install:      @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
++
++# Install almost everything without disturbing previous versions
++altinstall:   @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
++                sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
++
++# Install shared libraries enabled by Setup
++DESTDIRS=     $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
++
++oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
++              @for i in X $(SHAREDMODS); do \
++                if test $$i != X; then \
++                  echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
++                  $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
++                fi; \
++              done
++
++$(DESTSHARED):
++              @for i in $(DESTDIRS); \
++              do \
++                      if test ! -d $(DESTDIR)$$i; then \
++                              echo "Creating directory $$i"; \
++                              $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++                      else    true; \
++                      fi; \
++              done
++
++
++# Install the interpreter (by creating a hard link to python$(VERSION))
++bininstall:   altbininstall
++      -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
++      then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
++      else true; \
++      fi
++      (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
++      -rm -f $(DESTDIR)$(BINDIR)/python-config
++      (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
++
++# Install the interpreter with $(VERSION) affixed
++# This goes into $(exec_prefix)
++altbininstall:        $(BUILDPYTHON)
++      @for i in $(BINDIR) $(LIBDIR); \
++      do \
++              if test ! -d $(DESTDIR)$$i; then \
++                      echo "Creating directory $$i"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++              else    true; \
++              fi; \
++      done
++      $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
++      if test -f libpython$(VERSION)$(SO); then \
++              if test "$(SO)" = .dll; then \
++                      $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \
++              else \
++                      $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
++                      if test libpython$(VERSION)$(SO) != $(INSTSONAME); then \
++                              (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) libpython$(VERSION)$(SO)); \
++                      fi \
++              fi; \
++      else    true; \
++      fi
++
++# Install the manual page
++maninstall:
++      @for i in $(MANDIR) $(MANDIR)/man1; \
++      do \
++              if test ! -d $(DESTDIR)$$i; then \
++                      echo "Creating directory $$i"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++              else    true; \
++              fi; \
++      done
++      $(INSTALL_DATA) $(srcdir)/Misc/python.man \
++              $(DESTDIR)$(MANDIR)/man1/python.1
++
++# Install the library
++PLATDIR=      plat-$(MACHDEP)
++EXTRAPLATDIR= @EXTRAPLATDIR@
++EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
++MACHDEPS=     $(PLATDIR) $(EXTRAPLATDIR)
++XMLLIBSUBDIRS=  xml xml/dom xml/etree xml/parsers xml/sax
++PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
++      plat-mac/lib-scriptpackages/_builtinSuites \
++      plat-mac/lib-scriptpackages/CodeWarrior \
++      plat-mac/lib-scriptpackages/Explorer \
++      plat-mac/lib-scriptpackages/Finder \
++      plat-mac/lib-scriptpackages/Netscape \
++      plat-mac/lib-scriptpackages/StdSuites \
++      plat-mac/lib-scriptpackages/SystemEvents \
++      plat-mac/lib-scriptpackages/Terminal 
++PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
++LIBSUBDIRS=   lib-tk site-packages test test/output test/data \
++              test/decimaltestdata \
++              encodings compiler hotshot \
++              email email/mime email/test email/test/data \
++              sqlite3 sqlite3/test \
++              logging bsddb bsddb/test csv wsgiref \
++              ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
++              distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
++              setuptools setuptools/command setuptools/tests setuptools.egg-info \
++              curses $(MACHDEPS)
++libinstall: $(srcdir)/Lib/$(PLATDIR) $(PYTHON_FOR_BUILD)
++      @for i in $(SCRIPTDIR) $(LIBDEST); \
++      do \
++              if test ! -d $(DESTDIR)$$i; then \
++                      echo "Creating directory $$i"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++              else    true; \
++              fi; \
++      done
++      @for d in $(LIBSUBDIRS); \
++      do \
++              a=$(srcdir)/Lib/$$d; \
++              if test ! -d $$a; then continue; else true; fi; \
++              b=$(LIBDEST)/$$d; \
++              if test ! -d $(DESTDIR)$$b; then \
++                      echo "Creating directory $$b"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
++              else    true; \
++              fi; \
++      done
++      @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
++      do \
++              if test -x $$i; then \
++                      $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
++                      echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
++              else \
++                      $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
++                      echo $(INSTALL_DATA) $$i $(LIBDEST); \
++              fi; \
++      done
++      @for d in $(LIBSUBDIRS); \
++      do \
++              a=$(srcdir)/Lib/$$d; \
++              if test ! -d $$a; then continue; else true; fi; \
++              if test `ls $$a | wc -l` -lt 1; then continue; fi; \
++              b=$(LIBDEST)/$$d; \
++              for i in $$a/*; \
++              do \
++                      case $$i in \
++                      *CVS) ;; \
++                      *.py[co]) ;; \
++                      *.orig) ;; \
++                      *~) ;; \
++                      *) \
++                              if test -d $$i; then continue; fi; \
++                              if test -x $$i; then \
++                                  echo $(INSTALL_SCRIPT) $$i $$b; \
++                                  $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
++                              else \
++                                  echo $(INSTALL_DATA) $$i $$b; \
++                                  $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
++                              fi;; \
++                      esac; \
++              done; \
++      done
++      $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
++      PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
++              $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
++              -d $(LIBDEST) -f \
++              -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
++      PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
++              $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
++              -d $(LIBDEST) -f \
++              -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
++      -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
++              $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
++              -d $(LIBDEST)/site-packages -f \
++              -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
++      -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
++              $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
++              -d $(LIBDEST)/site-packages -f \
++              -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
++
++# Create the PLATDIR source directory, if one wasn't distributed..
++$(srcdir)/Lib/$(PLATDIR):
++      mkdir $(srcdir)/Lib/$(PLATDIR)
++      cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
++      export PATH; PATH="`pwd`:$$PATH"; \
++      export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
++      export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
++      export EXE; EXE="$(BUILDEXE)"; \
++      cd $(srcdir)/Lib/$(PLATDIR); ./regen
++
++# Install the include files
++INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
++inclinstall:
++      @for i in $(INCLDIRSTOMAKE); \
++      do \
++              if test ! -d $(DESTDIR)$$i; then \
++                      echo "Creating directory $$i"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++              else    true; \
++              fi; \
++      done
++      @for i in $(srcdir)/Include/*.h; \
++      do \
++              echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
++              $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
++      done
++      $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
++
++# Install the library and miscellaneous stuff needed for extending/embedding
++# This goes into $(exec_prefix)
++LIBPL=                $(LIBP)/config
++libainstall:  all
++      @for i in $(LIBDIR) $(LIBP) $(LIBPL); \
++      do \
++              if test ! -d $(DESTDIR)$$i; then \
++                      echo "Creating directory $$i"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++              else    true; \
++              fi; \
++      done
++      @if test -d $(LIBRARY); then :; else \
++              if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
++                      if test "$(SO)" = .dll; then \
++                              $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
++                      else \
++                              $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
++                              $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
++                      fi; \
++              else \
++                      echo Skip install of $(LIBRARY) - use make frameworkinstall; \
++              fi; \
++      fi
++      $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
++      $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
++      $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
++      $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
++      $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
++      $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
++      $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
++      $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
++      $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
++      # Substitution happens here, as the completely-expanded BINDIR
++      # is not available in configure
++      sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
++      $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
++      rm python-config
++      @if [ -s Modules/python.exp -a \
++              "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
++              echo; echo "Installing support files for building shared extension modules on AIX:"; \
++              $(INSTALL_DATA) Modules/python.exp              \
++                              $(DESTDIR)$(LIBPL)/python.exp;          \
++              echo; echo "$(LIBPL)/python.exp";               \
++              $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix  \
++                              $(DESTDIR)$(LIBPL)/makexp_aix;          \
++              echo "$(LIBPL)/makexp_aix";                     \
++              $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix   \
++                              $(DESTDIR)$(LIBPL)/ld_so_aix;           \
++              echo "$(LIBPL)/ld_so_aix";                      \
++              echo; echo "See Misc/AIX-NOTES for details.";   \
++      else true; \
++      fi
++      @case "$(MACHDEP)" in beos*) \
++              echo; echo "Installing support files for building shared extension modules on BeOS:"; \
++              $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README;      \
++              echo; echo "$(LIBPL)/README";                   \
++              $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
++              echo "$(LIBPL)/ar_beos";                        \
++              $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
++              echo "$(LIBPL)/ld_so_beos";                     \
++              echo; echo "See Misc/BeOS-NOTES for details.";  \
++              ;; \
++      esac
++
++# Install the dynamically loadable modules
++# This goes into $(exec_prefix)
++sharedinstall:
++      CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILING='$(CROSS_COMPILING)' \
++              $(RUNSHARED) $(PYTHON_FOR_BUILD) -E $(srcdir)/setup.py install \
++              --prefix=$(prefix) \
++              --install-scripts=$(BINDIR) \
++              --install-platlib=$(DESTSHARED) \
++              --root=/$(DESTDIR)
++
++# Here are a couple of targets for MacOSX again, to install a full
++# framework-based Python. frameworkinstall installs everything, the
++# subtargets install specific parts. Much of the actual work is offloaded to
++# the Makefile in Mac
++#
++#
++# This target is here for backward compatiblity, previous versions of Python
++# hadn't integrated framework installation in the normal install process.
++frameworkinstall: install
++
++# On install, we re-make the framework
++# structure in the install location, /Library/Frameworks/ or the argument to
++# --enable-framework. If --enable-framework has been specified then we have
++# automatically set prefix to the location deep down in the framework, so we
++# only have to cater for the structural bits of the framework.
++
++frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
++
++frameworkinstallstructure:    $(LDLIBRARY)
++      @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
++              echo Not configured with --enable-framework; \
++              exit 1; \
++      else true; \
++      fi
++      @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
++              if test ! -d $(DESTDIR)$$i; then \
++                      echo "Creating directory $(DESTDIR)$$i"; \
++                      $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
++              else    true; \
++              fi; \
++      done
++      $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
++      $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist
++      $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist
++      $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \
++              $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings
++      $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
++      $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python
++      $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
++      $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
++      $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
++
++# This installs Mac/Lib into the framework
++# Install a number of symlinks to keep software that expects a normal unix
++# install (which includes python-config) happy.
++frameworkinstallmaclib:
++      ln -fs "../../../Python" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
++      cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
++
++# This installs the IDE, the Launcher and other apps into /Applications
++frameworkinstallapps:
++      cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
++
++# This install the unix python and pythonw tools in /usr/local/bin
++frameworkinstallunixtools:
++      cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
++
++frameworkaltinstallunixtools:
++      cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
++
++# This installs the Demos and Tools into the applications directory.
++# It is not part of a normal frameworkinstall
++frameworkinstallextras:
++      cd Mac && Make installextras DESTDIR="$(DESTDIR)"
++
++# This installs a few of the useful scripts in Tools/scripts
++scriptsinstall:
++      $(RUNSHARED) \
++      $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
++      --prefix=$(prefix) \
++      --install-scripts=$(BINDIR) \
++      --root=/$(DESTDIR)
++
++# Build the toplevel Makefile
++Makefile.pre: Makefile.pre.in config.status
++      CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
++      $(MAKE) -f Makefile.pre Makefile
++
++# Run the configure script.
++config.status:        $(srcdir)/configure
++      $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
++
++.PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
++
++# Some make's put the object file in the current directory
++.c.o:
++      $(CC) -c $(PY_CFLAGS) -o $@ $<
++
++# Run reindent on the library
++reindent:
++      ./python$(EXEEXT) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
++
++# Rerun configure with the same options as it was run last time,
++# provided the config.status script exists
++recheck:
++      $(SHELL) config.status --recheck
++      $(SHELL) config.status
++
++# Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
++autoconf:
++      (cd $(srcdir); autoconf)
++      (cd $(srcdir); autoheader)
++
++# Create a tags file for vi
++tags::
++      cd $(srcdir); \
++      ctags -w -t Include/*.h; \
++      for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
++      done; \
++      sort -o tags tags
++
++# Create a tags file for GNU Emacs
++TAGS::
++      cd $(srcdir); \
++      etags Include/*.h; \
++      for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
++
++# Sanitation targets -- clean leaves libraries, executables and tags
++# files, which clobber removes those as well
++pycremoval:
++      find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
++
++clean: pycremoval
++      find . -name '*.o' -exec rm -f {} ';'
++      find . -name '*.s[ol]' -exec rm -f {} ';'
++      find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
++      find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
++
++clobber: clean
++      -rm -f $(BUILDPYTHON) $(PGEN_FOR_BUILD) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
++              tags TAGS \
++              config.cache config.log pyconfig.h Modules/config.c
++      -rm -rf build platform
++      -rm -rf $(PYTHONFRAMEWORKDIR)
++      -rm -rf buildpython
++
++# Make things extra clean, before making a distribution:
++# remove all generated files, even Makefile[.pre]
++# Keep configure and Python-ast.[ch], it's possible they can't be generated
++distclean: clobber
++      -rm -f core Makefile Makefile.pre config.status \
++              Modules/Setup Modules/Setup.local Modules/Setup.config
++      find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
++                         -o -name '[@,#]*' -o -name '*.old' \
++                         -o -name '*.orig' -o -name '*.rej' \
++                         -o -name '*.bak' ')' \
++                         -exec rm -f {} ';'
++
++# Check for smelly exported symbols (not starting with Py/_Py)
++smelly: all
++      nm -p $(LIBRARY) | \
++              sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
++
++# Find files with funny names
++funny:
++      find $(DISTDIRS) -type d \
++              -o -name '*.[chs]' \
++              -o -name '*.py' \
++              -o -name '*.doc' \
++              -o -name '*.sty' \
++              -o -name '*.bib' \
++              -o -name '*.dat' \
++              -o -name '*.el' \
++              -o -name '*.fd' \
++              -o -name '*.in' \
++              -o -name '*.tex' \
++              -o -name '*,[vpt]' \
++              -o -name 'Setup' \
++              -o -name 'Setup.*' \
++              -o -name README \
++              -o -name Makefile \
++              -o -name ChangeLog \
++              -o -name Repository \
++              -o -name Root \
++              -o -name Entries \
++              -o -name Tag \
++              -o -name tags \
++              -o -name TAGS \
++              -o -name .cvsignore \
++              -o -name MANIFEST \
++              -o -print
++
++# Dependencies
++
++Python/thread.o: @THREADHEADERS@
++
++# Declare targets that aren't real files
++.PHONY: all sharedmods oldsharedmods test quicktest memtest
++.PHONY: install altinstall oldsharedinstall bininstall altbininstall
++.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
++.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
++.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
++.PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean 
++.PHONY: smelly funny
++
++# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
+diff -urN Python-2.5.2.orig/Modules/gdbmmodule.c Python-2.5.2.mingw32/Modules/gdbmmodule.c
+--- Python-2.5.2.orig/Modules/gdbmmodule.c     2006-05-29 22:04:52.000000000 +0100
++++ Python-2.5.2.mingw32/Modules/gdbmmodule.c  2008-10-06 17:32:07.000000000 +0100
+@@ -11,7 +11,7 @@
+ #include <fcntl.h>
+ #include "gdbm.h"
+-#if defined(WIN32) && !defined(__CYGWIN__)
++#if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
+ #include "gdbmerrno.h"
+ extern const char * gdbm_strerror(gdbm_error);
+ #endif
+diff -urN Python-2.5.2.orig/Modules/posixmodule.c Python-2.5.2.mingw32/Modules/posixmodule.c
+--- Python-2.5.2.orig/Modules/posixmodule.c    2008-10-06 14:54:19.000000000 +0100
++++ Python-2.5.2.mingw32/Modules/posixmodule.c 2008-10-06 16:44:25.000000000 +0100
+@@ -130,6 +130,16 @@
+ #define HAVE_CWAIT    1
+ #define HAVE_FSYNC    1
+ #define fsync _commit
++#ifdef __MINGW32__    /* MinGW compiler */
++#define HAVE_GETCWD     1
++#define HAVE_SPAWNV   1
++#define HAVE_EXECV      1
++#define HAVE_PIPE       1
++#define HAVE_POPEN      1
++#define HAVE_SYSTEM   1
++#define HAVE_CWAIT    1
++#define HAVE_FSYNC    1
++#define fsync _commit
+ #else
+ #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)
+ /* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */
+@@ -156,6 +166,7 @@
+ #define HAVE_WAIT       1
+ #define HAVE_TTYNAME  1
+ #endif  /* PYOS_OS2 && PYCC_GCC && __VMS */
++#endif  /* __MINGW32__ */
+ #endif  /* _MSC_VER */
+ #endif  /* __BORLANDC__ */
+ #endif  /* ! __WATCOMC__ || __QNX__ */
+@@ -173,7 +184,7 @@
+ #if defined(PYCC_VACPP)
+ extern int mkdir(char *);
+ #else
+-#if ( defined(__WATCOMC__) || defined(_MSC_VER) ) && !defined(__QNX__)
++#if ( defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) ) && !defined(__QNX__)
+ extern int mkdir(const char *);
+ #else
+ extern int mkdir(const char *, mode_t);
+@@ -189,9 +200,13 @@
+ #ifdef __BORLANDC__
+ extern int chmod(const char *, int);
+ #else
++#ifndef __MINGW32__
+ extern int chmod(const char *, mode_t);
+ #endif
++#endif
++#ifndef __MINGW32__
+ extern int chown(const char *, uid_t, gid_t);
++#endif
+ extern char *getcwd(char *, int);
+ extern char *strerror(int);
+ extern int link(const char *, const char *);
+@@ -252,7 +267,7 @@
+ #endif
+ #endif
+-#ifdef _MSC_VER
++#if defined(_MSC_VER) || defined(__MINGW32__)
+ #ifdef HAVE_DIRECT_H
+ #include <direct.h>
+ #endif
+@@ -345,7 +360,7 @@
+ */
+ #include <crt_externs.h>
+ static char **environ;
+-#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
++#elif !defined(_MSC_VER) && !defined(__MINGW32__) && ( !defined(__WATCOMC__) || defined(__QNX__) )
+ extern char **environ;
+ #endif /* !_MSC_VER */
+@@ -2328,7 +2343,7 @@
+                             Py_FileSystemDefaultEncoding, &path, &mode))
+               return NULL;
+       Py_BEGIN_ALLOW_THREADS
+-#if ( defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__)
++#if ( defined(__MINGW32__) || defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__)
+       res = mkdir(path);
+ #else
+       res = mkdir(path, mode);
+@@ -7972,7 +7987,7 @@
+ }
+ #endif
+-#ifdef MS_WINDOWS
++#if defined(MS_WINDOWS) && !defined(__MINGW32__)
+ PyDoc_STRVAR(win32_urandom__doc__,
+ "urandom(n) -> str\n\n\
+@@ -8371,9 +8386,9 @@
+ #ifdef HAVE_GETLOADAVG
+       {"getloadavg",  posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__},
+ #endif
+- #ifdef MS_WINDOWS
++#if defined(MS_WINDOWS) && !defined(__MINGW32__)
+       {"urandom", win32_urandom, METH_VARARGS, win32_urandom__doc__},
+- #endif
++#endif
+  #ifdef __VMS
+       {"urandom", vms_urandom, METH_VARARGS, vms_urandom__doc__},
+  #endif
+@@ -8653,7 +8668,7 @@
+ }
+-#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__)
++#if (defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__)
+ #define INITFUNC initnt
+ #define MODNAME "nt"
+diff -urN Python-2.5.2.orig/Modules/Setup.dist Python-2.5.2.mingw32/Modules/Setup.dist
+--- Python-2.5.2.orig/Modules/Setup.dist       2008-10-06 14:54:19.000000000 +0100
++++ Python-2.5.2.mingw32/Modules/Setup.dist    2008-10-06 17:38:27.000000000 +0100
+@@ -111,7 +111,7 @@
+ posix posixmodule.c           # posix (UNIX) system calls
+ errno errnomodule.c           # posix (UNIX) errno values
+-pwd pwdmodule.c                       # this is needed to find out the user's home dir
++#pwd pwdmodule.c                      # this is needed to find out the user's home dir
+                               # if $HOME is not set
+ _sre _sre.c                   # Fredrik Lundh's new regular expressions
+ _codecs _codecsmodule.c               # access to the builtin codecs and codec registry
+@@ -159,7 +159,7 @@
+ # it, depending on your system -- see the GNU readline instructions.
+ # It's okay for this to be a shared library, too.
+-readline readline.c -lreadline -lncursesw
++readline readline.c -lreadline
+ # Modules that should always be present (non UNIX dependent):
+@@ -187,9 +187,9 @@
+ # (If you have a really backward UNIX, select and socket may not be
+ # supported...)
+-fcntl fcntlmodule.c   # fcntl(2) and ioctl(2)
+-spwd spwdmodule.c             # spwd(3) 
+-grp grpmodule.c               # grp(3)
++#fcntl fcntlmodule.c  # fcntl(2) and ioctl(2)
++#spwd spwdmodule.c            # spwd(3) 
++#grp grpmodule.c              # grp(3)
+ select selectmodule.c # select(2); not on ancient System V
+ # Memory-mapped files (also works on Win32).
+@@ -219,9 +219,9 @@
+ # Some more UNIX dependent modules -- off by default, since these
+ # are not supported by all UNIX systems:
+-nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
+-termios termios.c     # Steen Lumholt's termios module
+-resource resource.c   # Jeremy Hylton's rlimit interface
++#nis nismodule.c -lnsl        # Sun yellow pages -- not everywhere
++#termios termios.c    # Steen Lumholt's termios module
++#resource resource.c  # Jeremy Hylton's rlimit interface
+ # Multimedia modules -- off by default.
+@@ -293,12 +293,12 @@
+ # A Linux specific module -- off by default; this may also work on 
+ # some *BSDs.
+-linuxaudiodev linuxaudiodev.c
++#linuxaudiodev linuxaudiodev.c
+ # George Neville-Neil's timing module:
+-timing timingmodule.c
++#timing timingmodule.c
+ # The _tkinter module.
+@@ -313,7 +313,7 @@
+ # every system.
+ # *** Always uncomment this (leave the leading underscore in!):
+-_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
++#_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
+ # *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
+ #     -L/usr/local/lib \
+ # *** Uncomment and edit to reflect where your Tcl/Tk headers are:
+@@ -323,7 +323,7 @@
+ # *** Or uncomment this for Solaris:
+ #     -I/usr/openwin/include \
+ # *** Uncomment and edit for Tix extension only:
+-      -DWITH_TIX -ltix \
++#     -DWITH_TIX -ltix \
+ # *** Uncomment and edit for BLT extension only:
+ #     -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
+ # *** Uncomment and edit for PIL (TkImaging) extension only:
+@@ -332,7 +332,7 @@
+ # *** Uncomment and edit for TOGL extension only:
+ #     -DWITH_TOGL togl.c \
+ # *** Uncomment and edit to reflect your Tcl/Tk versions:
+-      -ltk -ltcl \
++#     -ltk -ltcl \
+ # *** Uncomment and edit to reflect where your X11 libraries are:
+ #     -L/usr/X11R6/lib \
+ # *** Or uncomment this for Solaris:
+@@ -342,7 +342,7 @@
+ # *** Uncomment for AIX:
+ #     -lld \
+ # *** Always uncomment this; X11 libraries to link with:
+-      -lX11
++#     -lX11
+ # Lance Ellinghaus's syslog module
+ #syslog syslogmodule.c                # syslog daemon interface
+@@ -354,9 +354,11 @@
+ #
+ # First, look at Setup.config; configure may have set this for you.
+-_curses _cursesmodule.c -lncursesw
++# XXX Should be possible to make this work with pdcurses.
++
++#_curses _cursesmodule.c -lncursesw
+ # Wrapper for the panel library that's part of ncurses and SYSV curses.
+-_curses_panel _curses_panel.c -lpanel -lncursesw 
++#_curses_panel _curses_panel.c -lpanel -lncursesw 
+ # Generic (SunOS / SVR4) dynamic loading module.
+@@ -364,7 +366,7 @@
+ # it is a highly experimental and dangerous device for calling
+ # *arbitrary* C functions in *arbitrary* shared libraries:
+-dl dlmodule.c
++#dl dlmodule.c
+ # Modules that provide persistent dictionary-like semantics.  You will
+@@ -402,10 +404,10 @@
+ #
+ # Edit the variables DB and DBLIBVERto point to the db top directory
+ # and the subdirectory of PORT where you built it.
+-DBLIBVER=4.7
+-DBINC=/usr/include/db4
+-DBLIB=/usr/lib64
+-_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
++#DBLIBVER=4.7
++#DBINC=/usr/include/db4
++#DBLIB=/usr/lib64
++#_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
+ # Historical Berkeley DB 1.85
+ #
+@@ -464,7 +466,7 @@
+ # More information on Expat can be found at www.libexpat.org.
+ #
+ #EXPAT_DIR=/usr/local/src/expat-1.95.2
+-pyexpat pyexpat.c -DHAVE_EXPAT_H -lexpat
++#pyexpat pyexpat.c -DHAVE_EXPAT_H -lexpat
+ # Hye-Shik Chang's CJKCodecs
+diff -urN Python-2.5.2.orig/Python/pythonrun.c Python-2.5.2.mingw32/Python/pythonrun.c
+--- Python-2.5.2.orig/Python/pythonrun.c       2007-05-02 17:02:48.000000000 +0100
++++ Python-2.5.2.mingw32/Python/pythonrun.c    2008-10-06 15:59:16.000000000 +0100
+@@ -1669,6 +1669,8 @@
+ int
+ PyOS_CheckStack(void)
+ {
++/* MinGW (gcc) defines _MSC_VER but doesn't have this exception stuff. */
++#ifndef __MINGW32__
+       __try {
+               /* alloca throws a stack overflow exception if there's
+                  not enough space left on the stack */
+@@ -1678,6 +1680,9 @@
+               /* just ignore all errors */
+       }
+       return 1;
++#else
++      return 0;
++#endif
+ }
+ #endif /* WIN32 && _MSC_VER */
+diff -urN Python-2.5.2.orig/README Python-2.5.2.mingw32/README
+--- Python-2.5.2.orig/README   2008-02-21 11:53:40.000000000 +0000
++++ Python-2.5.2.mingw32/README        2008-10-06 14:55:15.000000000 +0100
+@@ -1189,6 +1189,57 @@
+ do this.
++Cross Compiling
++---------------
++
++Python can be cross compiled by supplying different --build and --host
++parameters to configure.  Python is compiled on the "build" system and
++executed on the "host" system.  Cross compiling python requires a
++native Python on the build host, and a natively compiled tool `Pgen'.
++
++Before cross compiling, the correct version of Python must be compiled
++and installed on the build host.  The configure script will use `cc'
++and `python', or environment variables PYTHON_FOR_BUILD, eg:
++
++
++  PYTHON_FOR_BUILD=python2.5
++
++  # set these values according to your cross-compiler setup
++  PATH="$HOME/cross-target/freebsd-x86/usr/cross/bin:$PATH"
++
++  # headers & libraries for target system
++  CROSS_ROOT=$HOME/cross-target/freebsd-x86/
++
++  # supply all settings not correctly detected by configure.
++  # This can also be put a config.cache file
++  ac_cv_file__dev_ptmx=no
++  # .... insert more relevant settings
++  
++  export CROSS_ROOT PATH PYTHON_FOR_BUILD \
++       ac_cv_file__dev_ptmx  
++  
++  configure --host=i686-freebsd4 --with-system-ffi
++  make 
++
++   
++Cross compiling has been tested under linux. Your mileage may vary for
++other platforms.
++
++A few reminders on using configure to cross compile:
++- Cross compile tools must be in PATH,
++- Cross compile tools must be prefixed with the host type
++  (ie i586-mingw32-gcc, powerpc-darwin8-ranlib, ...),
++- CC, CXX, AR, and RANLIB must be undefined when running configure,
++  they will be auto-detected.
++- Autoconf must be stopped from autodetecting definitions for the
++  build machine.  This is easiest done by creating a config.cache
++  that overrides ac_cv_* variables appropriately.
++
++If you need a cross compiler, Debian ships several several (eg: avr,
++m68hc1x, mingw32), while dpkg-cross easily creates others.  Otherwise,
++check out Dan Kegel's crosstool: http://www.kegel.com/crosstool .
++
++
+ Miscellaneous issues
+ ====================
+diff -urN Python-2.5.2.orig/setup.py Python-2.5.2.mingw32/setup.py
+--- Python-2.5.2.orig/setup.py 2008-10-06 14:54:19.000000000 +0100
++++ Python-2.5.2.mingw32/setup.py      2008-10-06 17:40:57.000000000 +0100
+@@ -17,6 +17,15 @@
+ # This global variable is used to hold the list of modules to be disabled.
+ disabled_module_list = []
++import os
++
++if os.environ.get('CROSS_COMPILING') == 'yes':
++    sysconfig.get_config_vars()
++    sysconfig._config_vars.update (os.environ)
++else:
++    sysconfig.get_config_vars()
++    sysconfig._config_vars['srcdir'] = os.environ['srcdir']
++    
+ def add_dir_to_list(dirlist, dir):
+     """Add the directory 'dir' to the list 'dirlist' (at the front) if
+     1) 'dir' is not already in 'dirlist'
+@@ -203,6 +212,8 @@
+             self.announce('WARNING: skipping import check for Cygwin-based "%s"'
+                 % ext.name)
+             return
++        if os.environ.get('CROSS_COMPILING') == 'yes':
++            return
+         ext_filename = os.path.join(
+             self.build_lib,
+             self.get_ext_filename(self.get_ext_fullname(ext.name)))
+@@ -236,11 +247,15 @@
+                           level=3)
+     def get_platform(self):
+-        # Get value of sys.platform
+-        for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
+-            if sys.platform.startswith(platform):
++        # Get value of target's sys.platform
++        p = sys.platform
++        if os.environ.get('CROSS_COMPILING') == 'yes':
++            p = os.environ.get('MACHDEP').lower()
++
++        for platform in ['cygwin', 'mingw', 'beos', 'darwin', 'atheos', 'osf1']:
++            if p.startswith(platform):
+                 return platform
+-        return sys.platform
++        return p
+     def detect_modules(self):
+         # Ensure that /usr/local is always used
+@@ -294,11 +309,15 @@
+         # lib_dirs and inc_dirs are used to search for files;
+         # if a file is found in one of those directories, it can
+         # be assumed that no additional -I,-L directives are needed.
+-        lib_dirs = self.compiler.library_dirs + [
+-            '/lib64', '/usr/lib64',
+-            '/lib', '/usr/lib',
+-            ]
+-        inc_dirs = self.compiler.include_dirs + ['/usr/include']
++        lib_dirs = []
++        inc_dirs = []
++        if os.environ.get('CROSS_COMPILING') != 'yes':
++            lib_dirs = self.compiler.library_dirs + [
++                '/lib64', '/usr/lib64',
++                '/lib', '/usr/lib',
++                ]
++            inc_dirs = self.compiler.include_dirs + ['/usr/include']
++            
+         exts = []
+         config_h = sysconfig.get_config_h_filename()
+@@ -643,6 +662,9 @@
+             db_inc_paths.append('/pkg/db-3.%d/include' % x)
+             db_inc_paths.append('/opt/db-3.%d/include' % x)
++        if os.environ.get('CROSS_COMPILING') == 'yes':
++            db_inc_paths = []
++
+         # Add some common subdirectories for Sleepycat DB to the list,
+         # based on the standard include directories. This way DB3/4 gets
+         # picked up when it is installed in a non-standard prefix and
+@@ -771,6 +793,9 @@
+         MIN_SQLITE_VERSION = ".".join([str(x)
+                                     for x in MIN_SQLITE_VERSION_NUMBER])
++        if os.environ.get('CROSS_COMPILING') == 'yes':
++            sqlite_inc_paths = []
++
+         # Scan the default include directories before the SQLite specific
+         # ones. This allows one to override the copy of sqlite on OSX,
+         # where /usr/include contains an old version of sqlite.
+@@ -857,6 +882,8 @@
+         # the more recent berkeleydb's db.h file first in the include path
+         # when attempting to compile and it will fail.
+         f = "/usr/include/db.h"
++      if os.environ.get('CROSS_COMPILING') == 'yes':
++              f = ''
+         if os.path.exists(f) and not db_incs:
+             data = open(f).read()
+             m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
diff --git a/python/mingw32-python.spec b/python/mingw32-python.spec
new file mode 100644 (file)
index 0000000..fc877b4
--- /dev/null
@@ -0,0 +1,237 @@
+%define __strip %{_mingw32_strip}
+%define __objdump %{_mingw32_objdump}
+%define _use_internal_dependency_generator 0
+%define __find_requires %{_mingw32_findrequires}
+%define __find_provides %{_mingw32_findprovides}
+
+%{!?__python_ver:%define __python_ver EMPTY}
+#define __python_ver 25
+%define unicode ucs4
+
+%define _default_patch_fuzz     2
+
+%if "%{__python_ver}" != "EMPTY"
+%define main_python 0
+%define python python%{__python_ver}
+%define tkinter tkinter%{__python_ver}
+%else
+%define main_python 1
+%define python python
+%define tkinter tkinter
+%endif
+
+%define pybasever 2.5
+%define tools_dir %{_libdir}/python%{pybasever}/Tools
+%define demo_dir %{_libdir}/python%{pybasever}/Demo
+%define doc_tools_dir %{_libdir}/python%{pybasever}/Doc/tools
+
+Name:           mingw32-python
+Version:        2.5.2
+Release:        1%{?dist}
+Summary:        MinGW Windows port of Python programming language
+
+License:        Python
+Group:          Development/Libraries
+URL:            http://www.python.org/
+Source0:        http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.bz2
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:      noarch
+
+BuildRequires:  mingw32-filesystem >= 30
+BuildRequires:  mingw32-gcc
+BuildRequires:  mingw32-binutils
+
+# Only some of these deps have been ported to MinGW so far.  The
+# rest are listed here as they appear in the native python spec,
+# just so remember them.
+BuildPrereq:    mingw32-readline
+BuildPrereq:    mingw32-openssl
+#BuildPrereq:    gmp-devel
+#BuildPrereq:    ncurses-devel  <- doesn't exist for MinGW
+BuildPrereq:    mingw32-pdcurses
+BuildPrereq:    mingw32-gdbm
+BuildPrereq:    mingw32-zlib
+#BuildPrereq:    expat-devel
+#BuildPrereq:    libGL-devel
+#BuildPrereq:    tk
+#BuildPrereq:    tix
+BuildPrereq:    mingw32-gcc-c++
+#BuildPrereq:    libX11-devel
+#BuildPrereq:    glibc-devel <- no equivalent for MinGW
+#BuildPrereq:    tcl-devel
+#BuildPrereq:    tk-devel
+#BuildPrereq:    tix-devel
+BuildPrereq:    mingw32-bzip2
+BuildPrereq:    mingw32-sqlite
+#BuildPrereq:    db4-devel >= 4.7
+
+# Native dependencies.
+BuildPrereq:    bzip2
+BuildPrereq:    tar
+BuildPrereq:    /usr/bin/find
+BuildPrereq:    pkgconfig
+BuildPrereq:    autoconf
+
+# Required for cross-build.
+BuildRequires:  python = %{version}
+
+# Patches from native Fedora package.
+Patch0: python-2.5-config.patch
+Patch1: Python-2.2.1-pydocnogui.patch
+Patch2: python-2.3.4-pydocnodoc.patch
+Patch3: python-2.4.1-canonicalize.patch
+Patch4: python-2.5-cflags.patch
+Patch5: python-2.5.1-ctypes-exec-stack.patch
+Patch6: python-2.5.1-plural-fix.patch
+Patch7: python-2.5.1-sqlite-encoding.patch
+Patch8: python-2.5-xmlrpclib-marshal-objects.patch
+Patch9: python-2.5-tkinter.patch
+Patch10: python-2.5.2-binutils-no-dep.patch
+Patch11: python-2.5.1-codec-ascii-tolower.patch
+Patch12: python-2.5.1-pysqlite.patch
+Patch13: python-2.5.1-socketmodule-constants.patch
+Patch14: python-2.5.1-socketmodule-constants2.patch
+Patch15: python-2.5.1-listdir.patch
+#Patch50: python-2.5-disable-egginfo.patch
+Patch60: python-2.5.2-db47.patch
+Patch101: python-2.3.4-lib64-regex.patch
+Patch102: python-2.5-lib64.patch
+Patch260: python-2.5.2-set_wakeup_fd4.patch
+Patch999: python-2.5.CVE-2007-4965-int-overflow.patch
+Patch998: python-2.5-CVE-2008-2316.patch
+
+# MinGW-specific patches.
+# See: http://bugs.python.org/issue1597850
+Patch1000: mingw32-python-2.5.2-cross.patch
+
+
+%description
+Python is an interpreted, interactive, object-oriented programming
+language often compared to Tcl, Perl, Scheme or Java. Python includes
+modules, classes, exceptions, very high level dynamic data types and
+dynamic typing.
+
+This packages is the MinGW port of Python development tools and
+libraries.
+
+
+%prep
+%setup -q -n Python-%{version}
+
+%patch0 -p1 -b .rhconfig
+%patch1 -p1 -b .no_gui
+%patch2 -p1 -b .no-doc
+%patch3 -p1 -b .canonicalize
+%patch4 -p1 -b .cflags
+%patch5 -p1 -b .ctypesexec
+%patch6 -p1 -b .plural
+%patch7 -p1
+%patch8 -p1 -b .xmlrpc
+
+# Try not disabling egg-infos, bz#414711
+#patch50 -p1 -b .egginfo
+%patch60 -p1 -b .db47
+
+%if "%{_lib}" == "lib64"
+%patch101 -p1 -b .lib64-regex
+%patch102 -p1 -b .lib64
+%endif
+
+%patch10 -p1 -b .binutils-no-dep
+%patch11 -p1 -b .ascii-tolower
+%patch12 -p1 -b .pysqlite-2.3.3-minimal
+%patch13 -p1 -b .socketmodule
+%patch14 -p1 -b .socketmodule
+%patch15 -p1 -b .socketmodule
+
+%ifarch alpha ia64
+# 64bit, but not lib64 arches need this too...
+%patch101 -p1 -b .lib64-regex
+%endif
+
+%patch260 -p1 -b .set_wakeup_fd
+
+%patch999 -p1 -b .cve2007-4965
+%patch998 -p0 -b .cve2008-2316
+
+%patch1000 -p1 -b .mingw32
+
+# This shouldn't be necesarry, but is right now (2.2a3)
+find -name "*~" |xargs rm -f
+
+
+%build
+export PKG_CONFIG_PATH="%{_mingw32_libdir}/pkgconfig"
+
+# *_FOR_BUILD refer to the build compiler (for building intermediate
+# tools), not the cross-compiler.
+export CC_FOR_BUILD=gcc
+export PYTHON_FOR_BUILD=/usr/bin/python
+
+export CFLAGS="%{_mingw32_cflags} -D_GNU_SOURCE `pkg-config --cflags openssl`"
+export LDFLAGS="`pkg-config --libs-only-L openssl`"
+export CXXFLAGS="%{_mingw32_cflags} -m32 -D_GNU_SOURCE"
+export OPT="%{_mingw32_cflags} -D_GNU_SOURCE"
+export LINKCC="%{_mingw32_cc}"
+export LDSHARED="%{_mingw32_cc}"
+export BLDSHARED="%{_mingw32_cc}"
+
+export CROSS_ROOT=%{_mingw32_prefix}
+
+# Export these to avoid failing a cross-test in configure:
+export ac_cv_file__dev_ptmx=no
+export ac_cv_file__dev_ptc=no
+export ac_cv_printf_zd_format=yes
+
+# Automake is needed to get config.sub & config.guess.
+automake --add-missing ||:
+# Autoconf is needed because we patched configure.in.
+autoconf
+
+./configure \
+  --build=%_build --host=%{_mingw32_host} --target=%{_mingw32_target} \
+  --prefix=%{_mingw32_prefix} \
+  --enable-unicode=%{unicode} \
+  --enable-shared
+#  --enable-ipv6
+
+make OPT="$CFLAGS"
+# %{?_smp_mflags}
+
+topdir=`pwd`
+LD_LIBRARY_PATH=$topdir \
+  $topdir/python \
+    Tools/scripts/pathfix.py -i "%{_bindir}/env python%{pybasever}" .
+# Rebuild with new python
+# We need a link to a versioned python in the build directory
+ln -s python python%{pybasever}
+LD_LIBRARY_PATH=$topdir \
+  PATH=$PATH:$topdir \
+  make -s OPT="$CFLAGS"
+# %{?_smp_mflags}
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+exit 1
+make DESTDIR=$RPM_BUILD_ROOT install
+
+# Remove static libraries but DON'T remove *.dll.a files.
+rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libfoo.a
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root)
+%{_mingw32_bindir}/foo.dll
+%{_mingw32_libdir}/foo.dll.a
+# etc.
+
+
+%changelog
+* Wed Sep 24 2008 Your Name <you@example.com> - 1.2.3-1
+- Initial RPM release.
diff --git a/python/python-2.3.4-lib64-regex.patch b/python/python-2.3.4-lib64-regex.patch
new file mode 100644 (file)
index 0000000..2b38d4c
--- /dev/null
@@ -0,0 +1,18 @@
+--- Python-2.3.4/Lib/test/test_re.py                   2004-04-20 23:32:33.000000000 +0200
++++ Python-2.3.4/Lib/test/test_re.py.lib64-regex       2004-05-29 17:36:52.000000000 +0200
+@@ -497,6 +497,15 @@
+         self.assert_(re.compile('bug_926075') is not
+                      re.compile(eval("u'bug_926075'")))
++    def test_bug_931848(self):
++        try:
++            unicode
++        except NameError:
++            pass
++        pattern = eval('u"[\u002E\u3002\uFF0E\uFF61]"')
++        self.assertEqual(re.compile(pattern).split("a.b.c"),
++                         ['a','b','c'])
++
+ def run_re_tests():
+     from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR
+     if verbose:
diff --git a/python/python-2.3.4-pydocnodoc.patch b/python/python-2.3.4-pydocnodoc.patch
new file mode 100644 (file)
index 0000000..f2c1af3
--- /dev/null
@@ -0,0 +1,10 @@
+--- Python-2.3.4/Lib/pydoc.py.no-doc   2004-07-16 11:29:01.000000000 -0400
++++ Python-2.3.4/Lib/pydoc.py  2004-07-16 11:32:52.000000000 -0400
+@@ -1524,6 +1524,7 @@
+         homedir = os.environ.get('PYTHONHOME')
+         for dir in [os.environ.get('PYTHONDOCS'),
+                     homedir and os.path.join(homedir, 'doc'),
++                    '/usr/share/doc/python-docs-%s/html' % split(sys.version)[0],
+                     os.path.join(execdir, 'doc'),
+                     '/usr/doc/python-docs-' + split(sys.version)[0],
+                     '/usr/doc/python-' + split(sys.version)[0],
diff --git a/python/python-2.4.1-canonicalize.patch b/python/python-2.4.1-canonicalize.patch
new file mode 100644 (file)
index 0000000..4127359
--- /dev/null
@@ -0,0 +1,121 @@
+--- Python-2.4.1/pyconfig.h.in.canonicalize    2004-10-13 11:30:55.000000000 -0400
++++ Python-2.4.1/pyconfig.h.in 2005-10-06 14:04:06.000000000 -0400
+@@ -58,6 +58,9 @@
+ /* Define if pthread_sigmask() does not work on your system. */
+ #undef HAVE_BROKEN_PTHREAD_SIGMASK
++/* Define to 1 if you have the `canonicalize_file_name' function. */
++#undef HAVE_CANONICALIZE_FILE_NAME
++
+ /* Define to 1 if you have the `chown' function. */
+ #undef HAVE_CHOWN
+--- Python-2.4.1/Python/sysmodule.c.canonicalize       2005-01-27 13:58:30.000000000 -0500
++++ Python-2.4.1/Python/sysmodule.c    2005-10-06 14:56:37.000000000 -0400
+@@ -1168,11 +1168,13 @@
+ void
+ PySys_SetArgv(int argc, char **argv)
+ {
++#ifndef HAVE_CANONICALIZE_FILE_NAME
+ #if defined(HAVE_REALPATH)
+       char fullpath[MAXPATHLEN];
+ #elif defined(MS_WINDOWS)
+       char fullpath[MAX_PATH];
+ #endif
++#endif
+       PyObject *av = makeargvobject(argc, argv);
+       PyObject *path = PySys_GetObject("path");
+       if (av == NULL)
+@@ -1184,6 +1186,64 @@
+               char *p = NULL;
+               int n = 0;
+               PyObject *a;
++#ifdef HAVE_CANONICALIZE_FILE_NAME
++              char *link = NULL, *argv0copy = NULL;
++                
++                if (argc > 0 && argv0 != NULL) {
++                      
++                      link = canonicalize_file_name(argv0);
++                      if (link == NULL) {
++                              link = strdup(argv0);
++                              if (!link)
++                                      Py_FatalError("no mem for sys.argv");
++                      }
++              }
++              if (link) {
++                      if (link[0] == SEP) /* Link to absolute path */
++                              argv0 = link;
++                      else if (strchr(link, SEP) == NULL) {
++                              /* Link without path */
++                              /* strdup argv0 so we can free it 
++                                 unconditionally */
++                              argv0 = strdup(argv0);
++                              if (!argv0)
++                                      Py_FatalError("no mem for sys.argv");
++                              free(link);
++                      } else {
++                              /* Must join(dirname(argv0), link) */
++                              char *q = strrchr(argv0, SEP);
++                              if (q == NULL) /* argv0 without path */
++                                      argv0 = link;
++                              else {
++                                      /* Must make a copy */
++                                      argv0copy = calloc(
++                                                strlen(link) + strlen(q) +1,
++                                                sizeof (char));
++                                      if (!argv0copy)
++                                              Py_FatalError("no mem for sys.argv");
++                                      strcpy(argv0copy, argv0);
++                                      q = strrchr(argv0copy, SEP);
++                                      strcpy(argv0copy+1, link);
++                                      argv0 = argv0copy;
++                                      p = NULL;
++                                      free(link);
++                              }
++                      }
++              }
++              if (argc > 0 && argv0 != NULL) {
++                      char *q;
++                      p = strrchr(argv0, SEP);
++                      /* Test for alternate separator */
++                      q = strrchr(p ? p : argv0, '/');
++                      if (q != NULL)
++                              p = q;
++                      if (p != NULL) {
++                              n = p + 1 - argv0;
++                              if (n > 1 && p[-1] != ':')
++                                      n--; /* Drop trailing separator */
++                      }
++              }
++#else /* ! HAVE_CANONICALIZE_FILE_NAME */
+ #ifdef HAVE_READLINK
+               char link[MAXPATHLEN+1];
+               char argv0copy[2*MAXPATHLEN+1];
+@@ -1256,9 +1316,14 @@
+ #endif /* Unix */
+               }
+ #endif /* All others */
++#endif /* ! HAVE_CANONICALIZE_FILE_NAME */
+               a = PyString_FromStringAndSize(argv0, n);
+               if (a == NULL)
+                       Py_FatalError("no mem for sys.path insertion");
++#ifdef HAVE_CANONICALIZE_FILE_NAME
++              if (argc > 0 && argv0 != NULL)
++                      free(argv0);
++#endif /* HAVE_CANONICALIZE_FILE_NAME */
+               if (PyList_Insert(path, 0, a) < 0)
+                       Py_FatalError("sys.path.insert(0) failed");
+               Py_DECREF(a);
+--- Python-2.4.1/configure.in.canonicalize     2005-03-28 18:23:34.000000000 -0500
++++ Python-2.4.1/configure.in  2005-10-06 14:04:06.000000000 -0400
+@@ -2096,8 +2096,8 @@
+ AC_MSG_RESULT(MACHDEP_OBJS)
+ # checks for library functions
+-AC_CHECK_FUNCS(alarm bind_textdomain_codeset chown clock confstr ctermid \
+- execv fork fpathconf ftime ftruncate \
++AC_CHECK_FUNCS(alarm bind_textdomain_codeset canonicalize_file_name chown \
++ clock confstr ctermid execv fork fpathconf ftime ftruncate \
+  gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
+  getpriority getpwent getsid getwd \
+  kill killpg lchown lstat mkfifo mknod mktime \
diff --git a/python/python-2.5-CVE-2008-2316.patch b/python/python-2.5-CVE-2008-2316.patch
new file mode 100644 (file)
index 0000000..450354b
--- /dev/null
@@ -0,0 +1,156 @@
+Index: Lib/test/test_hashlib.py
+===================================================================
+--- Lib/test/test_hashlib.py   (revision 64642)
++++ Lib/test/test_hashlib.py   (working copy)
+@@ -9,8 +9,8 @@
+ import hashlib
+ import unittest
+ from test import test_support
++from test.test_support import _4G, precisionbigmemtest
+-
+ def hexstr(s):
+     import string
+     h = string.hexdigits
+@@ -55,7 +55,6 @@
+             m2.update(aas + bees + cees)
+             self.assertEqual(m1.digest(), m2.digest())
+-
+     def check(self, name, data, digest):
+         # test the direct constructors
+         computed = getattr(hashlib, name)(data).hexdigest()
+@@ -74,8 +73,23 @@
+     def test_case_md5_2(self):
+         self.check('md5', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
+                    'd174ab98d277d9f5a5611c2c9f419d9f')
++    
++    @precisionbigmemtest(size=_4G + 5, memuse=1)
++    def test_case_md5_huge(self, size):
++        if size == _4G + 5:
++            try:
++                self.check('md5', 'A'*size, 'c9af2dff37468ce5dfee8f2cfc0a9c6d')
++            except OverflowError:
++                pass # 32-bit arch
++    
++    @precisionbigmemtest(size=_4G - 1, memuse=1)
++    def test_case_md5_uintmax(self, size):
++        if size == _4G - 1:
++            try:
++                self.check('md5', 'A'*size, '28138d306ff1b8281f1a9067e1a1a2b3')
++            except OverflowError:
++                pass # 32-bit arch
+-
+     # use the three examples from Federal Information Processing Standards
+     # Publication 180-1, Secure Hash Standard,  1995 April 17
+     # http://www.itl.nist.gov/div897/pubs/fip180-1.htm
+Index: Modules/_hashopenssl.c
+===================================================================
+--- Modules/_hashopenssl.c     (revision 64642)
++++ Modules/_hashopenssl.c     (working copy)
+@@ -19,7 +19,9 @@
+ /* EVP is the preferred interface to hashing in OpenSSL */
+ #include <openssl/evp.h>
++#define MUNCH_SIZE INT_MAX
++
+ #ifndef HASH_OBJ_CONSTRUCTOR
+ #define HASH_OBJ_CONSTRUCTOR 0
+ #endif
+@@ -164,9 +166,18 @@
+     if (!PyArg_ParseTuple(args, "s#:update", &cp, &len))
+         return NULL;
++    if (len > 0 && len <= MUNCH_SIZE) {
+     EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
+                                                       unsigned int));
+-
++    } else {
++        Py_ssize_t offset = 0;
++        while (len) {
++            unsigned int process = len > MUNCH_SIZE ? MUNCH_SIZE : len;
++            EVP_DigestUpdate(&self->ctx, cp + offset, process);
++            len -= process;
++            offset += process;
++        }
++    }
+     Py_INCREF(Py_None);
+     return Py_None;
+ }
+@@ -255,10 +266,21 @@
+     self->name = name_obj;
+     Py_INCREF(self->name);
+-    if (cp && len)
++    if (cp && len) {
++        if (len > 0 && len <= MUNCH_SIZE) {
+         EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
+                                                           unsigned int));
+-
++        } else {
++            Py_ssize_t offset = 0;
++            while (len) {
++                unsigned int process = len > MUNCH_SIZE ? MUNCH_SIZE : len;
++                EVP_DigestUpdate(&self->ctx, cp + offset, process);
++                len -= process;
++                offset += process;
++            }
++        }
++    }
++    
+     return 0;
+ }
+ #endif
+@@ -328,7 +350,7 @@
+ static PyObject *
+ EVPnew(PyObject *name_obj,
+        const EVP_MD *digest, const EVP_MD_CTX *initial_ctx,
+-       const unsigned char *cp, unsigned int len)
++       const unsigned char *cp, Py_ssize_t len)
+ {
+     EVPobject *self;
+@@ -346,8 +368,20 @@
+         EVP_DigestInit(&self->ctx, digest);
+     }
+-    if (cp && len)
+-        EVP_DigestUpdate(&self->ctx, cp, len);
++    if (cp && len) {
++        if (len > 0 && len <= MUNCH_SIZE) {
++            EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
++                                                              unsigned int));
++        } else {
++            Py_ssize_t offset = 0;
++            while (len) {
++                unsigned int process = len > MUNCH_SIZE ? MUNCH_SIZE : len;
++                EVP_DigestUpdate(&self->ctx, cp + offset, process);
++                len -= process;
++                offset += process;
++            }
++        }
++    }
+     return (PyObject *)self;
+ }
+@@ -384,8 +418,7 @@
+     digest = EVP_get_digestbyname(name);
+-    return EVPnew(name_obj, digest, NULL, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
+-                                                               unsigned int));
++    return EVPnew(name_obj, digest, NULL, cp, len);
+ }
+ /*
+@@ -410,7 +443,7 @@
+                 CONST_ ## NAME ## _name_obj, \
+                 NULL, \
+                 CONST_new_ ## NAME ## _ctx_p, \
+-                cp, Py_SAFE_DOWNCAST(len, Py_ssize_t, unsigned int)); \
++                cp, len); \
+     }
+ /* a PyMethodDef structure for the constructor */
diff --git a/python/python-2.5-cflags.patch b/python/python-2.5-cflags.patch
new file mode 100644 (file)
index 0000000..32243bf
--- /dev/null
@@ -0,0 +1,11 @@
+--- Python-2.5c1/Makefile.pre.in.cflags        2006-08-18 11:05:40.000000000 -0400
++++ Python-2.5c1/Makefile.pre.in       2006-08-18 11:09:26.000000000 -0400
+@@ -334,7 +334,7 @@
+ # Build the interpreter
+ $(BUILDPYTHON):       Modules/python.o $(LIBRARY) $(LDLIBRARY)
+-              $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
++              $(LINKCC) $(CFLAGS) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
+                       Modules/python.o \
+                       $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
diff --git a/python/python-2.5-config.patch b/python/python-2.5-config.patch
new file mode 100644 (file)
index 0000000..20b0573
--- /dev/null
@@ -0,0 +1,332 @@
+--- Python-2.5.1/Include/pyexpat.h.rhconfig    2006-06-19 19:21:25.000000000 -0400
++++ Python-2.5.1/Include/pyexpat.h     2007-06-27 10:12:45.000000000 -0400
+@@ -5,6 +5,19 @@
+ #define PyExpat_CAPI_MAGIC  "pyexpat.expat_CAPI 1.0"
++#ifdef XML_LARGE_SIZE  /* Use large integers for file/stream positions. */
++#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
++typedef __int64 XML_Index; 
++typedef unsigned __int64 XML_Size;
++#else
++typedef long long XML_Index;
++typedef unsigned long long XML_Size;
++#endif
++#else
++typedef long XML_Index;
++typedef unsigned long XML_Size;
++#endif /* XML_LARGE_SIZE */
++
+ struct PyExpat_CAPI 
+ {
+     char* magic; /* set to PyExpat_CAPI_MAGIC */
+--- Python-2.5.1/Modules/Setup.dist.rhconfig   2006-08-06 03:26:21.000000000 -0400
++++ Python-2.5.1/Modules/Setup.dist    2007-06-27 10:12:45.000000000 -0400
+@@ -149,7 +149,7 @@ GLHACK=-Dclear=__GLclear
+ # modules are to be built as shared libraries (see above for more
+ # detail; also note that *static* reverses this effect):
+-#*shared*
++*shared*
+ # GNU readline.  Unlike previous Python incarnations, GNU readline is
+ # now incorporated in an optional module, configured in the Setup file
+@@ -159,69 +159,69 @@ GLHACK=-Dclear=__GLclear
+ # it, depending on your system -- see the GNU readline instructions.
+ # It's okay for this to be a shared library, too.
+-#readline readline.c -lreadline -ltermcap
++readline readline.c -lreadline -lncursesw
+ # Modules that should always be present (non UNIX dependent):
+-#array arraymodule.c  # array objects
+-#cmath cmathmodule.c # -lm # complex math library functions
+-#math mathmodule.c # -lm # math library functions, e.g. sin()
+-#_struct _struct.c    # binary structure packing/unpacking
+-#time timemodule.c # -lm # time operations and variables
+-#operator operator.c  # operator.add() and similar goodies
+-#_weakref _weakref.c  # basic weak reference support
+-#_testcapi _testcapimodule.c    # Python C API test module
+-#_random _randommodule.c      # Random number generator
+-#collections collectionsmodule.c # Container types
+-#itertools itertoolsmodule.c  # Functions creating iterators for efficient looping 
+-#strop stropmodule.c          # String manipulations
++array arraymodule.c   # array objects
++cmath cmathmodule.c # -lm # complex math library functions
++math mathmodule.c # -lm # math library functions, e.g. sin()
++_struct _struct.c     # binary structure packing/unpacking
++time timemodule.c # -lm # time operations and variables
++operator operator.c   # operator.add() and similar goodies
++_weakref _weakref.c   # basic weak reference support
++_testcapi _testcapimodule.c    # Python C API test module
++_random _randommodule.c       # Random number generator
++collections collectionsmodule.c # Container types
++itertools itertoolsmodule.c   # Functions creating iterators for efficient looping 
++strop stropmodule.c           # String manipulations
+-#unicodedata unicodedata.c    # static Unicode character database
++unicodedata unicodedata.c    # static Unicode character database
+ # access to ISO C locale support
+-#_locale _localemodule.c  # -lintl
++_locale _localemodule.c  # -lintl
+ # Modules with some UNIX dependencies -- on by default:
+ # (If you have a really backward UNIX, select and socket may not be
+ # supported...)
+-#fcntl fcntlmodule.c  # fcntl(2) and ioctl(2)
+-#spwd spwdmodule.c            # spwd(3) 
+-#grp grpmodule.c              # grp(3)
+-#select selectmodule.c        # select(2); not on ancient System V
++fcntl fcntlmodule.c   # fcntl(2) and ioctl(2)
++spwd spwdmodule.c             # spwd(3) 
++grp grpmodule.c               # grp(3)
++select selectmodule.c # select(2); not on ancient System V
+ # Memory-mapped files (also works on Win32).
+-#mmap mmapmodule.c
++mmap mmapmodule.c
+ # CSV file helper
+-#_csv _csv.c
++_csv _csv.c
+ # Socket module helper for socket(2)
+-#_socket socketmodule.c
++_socket socketmodule.c
+ # Socket module helper for SSL support; you must comment out the other
+ # socket line above, and possibly edit the SSL variable:
+ #SSL=/usr/local/ssl
+-#_ssl _ssl.c \
+-#     -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
+-#     -L$(SSL)/lib -lssl -lcrypto
++_ssl _ssl.c \
++      -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
++      -L$(SSL)/lib -lssl -lcrypto
+ # The crypt module is now disabled by default because it breaks builds
+ # on many systems (where -lcrypt is needed), e.g. Linux (I believe).
+ #
+ # First, look at Setup.config; configure may have set this for you.
+-#crypt cryptmodule.c # -lcrypt        # crypt(3); needs -lcrypt on some systems
++crypt cryptmodule.c -lcrypt   # crypt(3); needs -lcrypt on some systems
+ # Some more UNIX dependent modules -- off by default, since these
+ # are not supported by all UNIX systems:
+-#nis nismodule.c -lnsl        # Sun yellow pages -- not everywhere
+-#termios termios.c    # Steen Lumholt's termios module
+-#resource resource.c  # Jeremy Hylton's rlimit interface
++nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
++termios termios.c     # Steen Lumholt's termios module
++resource resource.c   # Jeremy Hylton's rlimit interface
+ # Multimedia modules -- off by default.
+@@ -229,9 +229,9 @@ GLHACK=-Dclear=__GLclear
+ # #993173 says audioop works on 64-bit platforms, though.
+ # These represent audio samples or images as strings:
+-#audioop audioop.c    # Operations on audio samples
+-#imageop imageop.c    # Operations on images
+-#rgbimg rgbimgmodule.c        # Read SGI RGB image files (but coded portably)
++audioop audioop.c     # Operations on audio samples
++imageop imageop.c     # Operations on images
++rgbimg rgbimgmodule.c # Read SGI RGB image files (but coded portably)
+ # Note that the _md5 and _sha modules are normally only built if the
+@@ -241,12 +241,12 @@ GLHACK=-Dclear=__GLclear
+ # Message-Digest Algorithm, described in RFC 1321.  The necessary files
+ # md5.c and md5.h are included here.
+-#_md5 md5module.c md5.c
++_md5 md5module.c md5.c
+ # The _sha module implements the SHA checksum algorithm.
+ # (NIST's Secure Hash Algorithm.)
+-#_sha shamodule.c
++_sha shamodule.c
+ # SGI IRIX specific modules -- off by default.
+@@ -293,12 +293,12 @@ GLHACK=-Dclear=__GLclear
+ # A Linux specific module -- off by default; this may also work on 
+ # some *BSDs.
+-#linuxaudiodev linuxaudiodev.c
++linuxaudiodev linuxaudiodev.c
+ # George Neville-Neil's timing module:
+-#timing timingmodule.c
++timing timingmodule.c
+ # The _tkinter module.
+@@ -313,7 +313,7 @@ GLHACK=-Dclear=__GLclear
+ # every system.
+ # *** Always uncomment this (leave the leading underscore in!):
+-# _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
++_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
+ # *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
+ #     -L/usr/local/lib \
+ # *** Uncomment and edit to reflect where your Tcl/Tk headers are:
+@@ -323,7 +323,7 @@ GLHACK=-Dclear=__GLclear
+ # *** Or uncomment this for Solaris:
+ #     -I/usr/openwin/include \
+ # *** Uncomment and edit for Tix extension only:
+-#     -DWITH_TIX -ltix8.1.8.2 \
++      -DWITH_TIX -ltix \
+ # *** Uncomment and edit for BLT extension only:
+ #     -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
+ # *** Uncomment and edit for PIL (TkImaging) extension only:
+@@ -332,7 +332,7 @@ GLHACK=-Dclear=__GLclear
+ # *** Uncomment and edit for TOGL extension only:
+ #     -DWITH_TOGL togl.c \
+ # *** Uncomment and edit to reflect your Tcl/Tk versions:
+-#     -ltk8.2 -ltcl8.2 \
++      -ltk -ltcl \
+ # *** Uncomment and edit to reflect where your X11 libraries are:
+ #     -L/usr/X11R6/lib \
+ # *** Or uncomment this for Solaris:
+@@ -342,7 +342,7 @@ GLHACK=-Dclear=__GLclear
+ # *** Uncomment for AIX:
+ #     -lld \
+ # *** Always uncomment this; X11 libraries to link with:
+-#     -lX11
++      -lX11
+ # Lance Ellinghaus's syslog module
+ #syslog syslogmodule.c                # syslog daemon interface
+@@ -354,9 +354,9 @@ GLHACK=-Dclear=__GLclear
+ #
+ # First, look at Setup.config; configure may have set this for you.
+-#_curses _cursesmodule.c -lcurses -ltermcap
++_curses _cursesmodule.c -lncursesw
+ # Wrapper for the panel library that's part of ncurses and SYSV curses.
+-#_curses_panel _curses_panel.c -lpanel -lncurses 
++_curses_panel _curses_panel.c -lpanel -lncursesw 
+ # Generic (SunOS / SVR4) dynamic loading module.
+@@ -364,7 +364,7 @@ GLHACK=-Dclear=__GLclear
+ # it is a highly experimental and dangerous device for calling
+ # *arbitrary* C functions in *arbitrary* shared libraries:
+-#dl dlmodule.c
++dl dlmodule.c
+ # Modules that provide persistent dictionary-like semantics.  You will
+@@ -387,7 +387,7 @@ GLHACK=-Dclear=__GLclear
+ #
+ # First, look at Setup.config; configure may have set this for you.
+-#gdbm gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm
++gdbm gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm
+ # Sleepycat Berkeley DB interface.
+@@ -402,11 +402,10 @@ GLHACK=-Dclear=__GLclear
+ #
+ # Edit the variables DB and DBLIBVERto point to the db top directory
+ # and the subdirectory of PORT where you built it.
+-#DB=/usr/local/BerkeleyDB.4.0
+-#DBLIBVER=4.0
+-#DBINC=$(DB)/include
+-#DBLIB=$(DB)/lib
+-#_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
++DBLIBVER=4.7
++DBINC=/usr/include/db4
++DBLIB=/usr/lib
++_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
+ # Historical Berkeley DB 1.85
+ #
+@@ -421,14 +420,14 @@ GLHACK=-Dclear=__GLclear
+ # Helper module for various ascii-encoders
+-#binascii binascii.c
++binascii binascii.c
+ # Fred Drake's interface to the Python parser
+-#parser parsermodule.c
++parser parsermodule.c
+ # cStringIO and cPickle
+-#cStringIO cStringIO.c
+-#cPickle cPickle.c
++cStringIO cStringIO.c
++cPickle cPickle.c
+ # Lee Busby's SIGFPE modules.
+@@ -451,7 +450,7 @@ GLHACK=-Dclear=__GLclear
+ # Andrew Kuchling's zlib module.
+ # This require zlib 1.1.3 (or later).
+ # See http://www.gzip.org/zlib/
+-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
++zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
+ # Interface to the Expat XML parser
+ #
+@@ -465,20 +464,20 @@ GLHACK=-Dclear=__GLclear
+ # More information on Expat can be found at www.libexpat.org.
+ #
+ #EXPAT_DIR=/usr/local/src/expat-1.95.2
+-#pyexpat pyexpat.c -DHAVE_EXPAT_H -I$(EXPAT_DIR)/lib -L$(EXPAT_DIR) -lexpat
++pyexpat pyexpat.c -DHAVE_EXPAT_H -lexpat
+ # Hye-Shik Chang's CJKCodecs
+ # multibytecodec is required for all the other CJK codec modules
+-#_multibytecodec cjkcodecs/multibytecodec.c
++_multibytecodec cjkcodecs/multibytecodec.c
+-#_codecs_cn cjkcodecs/_codecs_cn.c
+-#_codecs_hk cjkcodecs/_codecs_hk.c
+-#_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
+-#_codecs_jp cjkcodecs/_codecs_jp.c
+-#_codecs_kr cjkcodecs/_codecs_kr.c
+-#_codecs_tw cjkcodecs/_codecs_tw.c
++_codecs_cn cjkcodecs/_codecs_cn.c
++_codecs_hk cjkcodecs/_codecs_hk.c
++_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
++_codecs_jp cjkcodecs/_codecs_jp.c
++_codecs_kr cjkcodecs/_codecs_kr.c
++_codecs_tw cjkcodecs/_codecs_tw.c
+ # Example -- included for reference only:
+ # xx xxmodule.c
+--- Python-2.5.1/setup.py.rhconfig     2007-06-27 10:26:41.000000000 -0400
++++ Python-2.5.1/setup.py      2007-06-27 10:26:51.000000000 -0400
+@@ -998,7 +998,6 @@ class PyBuildExt(build_ext):
+         exts.append(Extension('pyexpat',
+                               define_macros = define_macros,
+-                              include_dirs = [expatinc],
+                               sources = ['pyexpat.c',
+                                          'expat/xmlparse.c',
+                                          'expat/xmlrole.c',
+@@ -1013,7 +1012,6 @@ class PyBuildExt(build_ext):
+             define_macros.append(('USE_PYEXPAT_CAPI', None))
+             exts.append(Extension('_elementtree',
+                                   define_macros = define_macros,
+-                                  include_dirs = [expatinc],
+                                   sources = ['_elementtree.c'],
+                                   ))
diff --git a/python/python-2.5-disable-egginfo.patch b/python/python-2.5-disable-egginfo.patch
new file mode 100644 (file)
index 0000000..920b90c
--- /dev/null
@@ -0,0 +1,11 @@
+--- Python-2.5/Lib/distutils/command/install.py.egginfo        2006-12-06 17:12:57.000000000 -0500
++++ Python-2.5/Lib/distutils/command/install.py        2006-12-06 17:13:10.000000000 -0500
+@@ -601,7 +601,7 @@
+                     ('install_headers', has_headers),
+                     ('install_scripts', has_scripts),
+                     ('install_data',    has_data),
+-                    ('install_egg_info', lambda self:True),
++                    ('install_egg_info', lambda self:False),
+                    ]
+ # class install
diff --git a/python/python-2.5-lib64.patch b/python/python-2.5-lib64.patch
new file mode 100644 (file)
index 0000000..3e8c245
--- /dev/null
@@ -0,0 +1,165 @@
+--- Python-2.5b1/Lib/distutils/command/install.py.lib64        2006-03-27 16:55:21.000000000 -0500
++++ Python-2.5b1/Lib/distutils/command/install.py      2006-06-22 12:20:35.000000000 -0400
+@@ -39,14 +39,14 @@
+ INSTALL_SCHEMES = {
+     'unix_prefix': {
+         'purelib': '$base/lib/python$py_version_short/site-packages',
+-        'platlib': '$platbase/lib/python$py_version_short/site-packages',
++        'platlib': '$platbase/lib64/python$py_version_short/site-packages',
+         'headers': '$base/include/python$py_version_short/$dist_name',
+         'scripts': '$base/bin',
+         'data'   : '$base',
+         },
+     'unix_home': {
+         'purelib': '$base/lib/python',
+-        'platlib': '$base/lib/python',
++        'platlib': '$base/lib64/python',
+         'headers': '$base/include/python/$dist_name',
+         'scripts': '$base/bin',
+         'data'   : '$base',
+--- Python-2.5b1/Lib/distutils/sysconfig.py.lib64      2006-05-23 08:01:11.000000000 -0400
++++ Python-2.5b1/Lib/distutils/sysconfig.py    2006-06-22 12:20:35.000000000 -0400
+@@ -99,8 +99,12 @@
+         prefix = plat_specific and EXEC_PREFIX or PREFIX
+     if os.name == "posix":
++        if plat_specific or standard_lib:
++            lib = "lib64"
++        else:
++            lib = "lib"
+         libpython = os.path.join(prefix,
+-                                 "lib", "python" + get_python_version())
++                                 lib, "python" + get_python_version())
+         if standard_lib:
+             return libpython
+         else:
+--- Python-2.5b1/Lib/site.py.lib64     2006-06-12 04:23:02.000000000 -0400
++++ Python-2.5b1/Lib/site.py   2006-06-22 12:20:35.000000000 -0400
+@@ -182,9 +182,14 @@
+                 sitedirs = [os.path.join(prefix, "Lib", "site-packages")]
+             elif os.sep == '/':
+                 sitedirs = [os.path.join(prefix,
+-                                         "lib",
++                                         "lib64",
+                                          "python" + sys.version[:3],
+                                          "site-packages"),
++                            os.path.join(prefix,
++                                         "lib",
++                                         "python" + sys.version[:3],
++                                         "site-packages"),                            
++                            os.path.join(prefix, "lib64", "site-python"),
+                             os.path.join(prefix, "lib", "site-python")]
+             else:
+                 sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
+--- Python-2.5b1/setup.py.lib64        2006-06-05 19:38:06.000000000 -0400
++++ Python-2.5b1/setup.py      2006-06-22 12:22:14.000000000 -0400
+@@ -244,7 +244,7 @@
+     def detect_modules(self):
+         # Ensure that /usr/local is always used
+-        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
++        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64')
+         add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+         # Add paths specified in the environment variables LDFLAGS and
+@@ -496,11 +496,11 @@
+             elif self.compiler.find_library_file(lib_dirs, 'curses'):
+                 readline_libs.append('curses')
+             elif self.compiler.find_library_file(lib_dirs +
+-                                               ['/usr/lib/termcap'],
++                                               ['/usr/lib64/termcap'],
+                                                'termcap'):
+                 readline_libs.append('termcap')
+             exts.append( Extension('readline', ['readline.c'],
+-                                   library_dirs=['/usr/lib/termcap'],
++                                   library_dirs=['/usr/lib64/termcap'],
+                                    extra_link_args=readline_extra_link_args,
+                                    libraries=readline_libs) )
+         if platform not in ['mac']:
+@@ -532,8 +532,8 @@
+             if krb5_h:
+                 ssl_incs += krb5_h
+         ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
+-                                     ['/usr/local/ssl/lib',
+-                                      '/usr/contrib/ssl/lib/'
++                                     ['/usr/local/ssl/lib64',
++                                      '/usr/contrib/ssl/lib64/'
+                                      ] )
+         if (ssl_incs is not None and
+--- Python-2.5b1/Makefile.pre.in.lib64 2006-06-11 15:45:57.000000000 -0400
++++ Python-2.5b1/Makefile.pre.in       2006-06-22 12:20:34.000000000 -0400
+@@ -84,11 +84,11 @@
+ # Expanded directories
+ BINDIR=               $(exec_prefix)/bin
+-LIBDIR=               $(exec_prefix)/lib
++LIBDIR=               $(exec_prefix)/lib64
+ MANDIR=               @mandir@
+ INCLUDEDIR=   @includedir@
+ CONFINCLUDEDIR=       $(exec_prefix)/include
+-SCRIPTDIR=    $(prefix)/lib
++SCRIPTDIR=    $(prefix)/lib64
+ # Detailed destination directories
+ BINLIBDEST=   $(LIBDIR)/python$(VERSION)
+--- Python-2.5b1/Modules/Setup.dist.lib64      2006-06-22 12:20:34.000000000 -0400
++++ Python-2.5b1/Modules/Setup.dist    2006-06-22 12:20:35.000000000 -0400
+@@ -401,7 +401,7 @@
+ # and the subdirectory of PORT where you built it.
+ DBLIBVER=4.3
+ DBINC=/usr/include/db4
+-DBLIB=/usr/lib
++DBLIB=/usr/lib64
+ _bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
+ # Historical Berkeley DB 1.85
+@@ -447,7 +447,7 @@
+ # Andrew Kuchling's zlib module.
+ # This require zlib 1.1.3 (or later).
+ # See http://www.gzip.org/zlib/
+-zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
++zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib64 -lz
+ # Interface to the Expat XML parser
+ #
+--- Python-2.5b1/Modules/getpath.c.lib64       2006-04-12 22:06:09.000000000 -0400
++++ Python-2.5b1/Modules/getpath.c     2006-06-22 12:20:35.000000000 -0400
+@@ -117,8 +117,8 @@
+ #endif
+ #ifndef PYTHONPATH
+-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
+-              EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
++#define PYTHONPATH PREFIX "/lib64/python" VERSION ":" \
++              EXEC_PREFIX "/lib64/python" VERSION "/lib-dynload"
+ #endif
+ #ifndef LANDMARK
+@@ -129,7 +129,7 @@
+ static char exec_prefix[MAXPATHLEN+1];
+ static char progpath[MAXPATHLEN+1];
+ static char *module_search_path = NULL;
+-static char lib_python[] = "lib/python" VERSION;
++static char lib_python[] = "lib64/python" VERSION;
+ static void
+ reduce(char *dir)
+@@ -524,7 +524,7 @@
+     }
+     else
+         strncpy(zip_path, PREFIX, MAXPATHLEN);
+-    joinpath(zip_path, "lib/python00.zip");
++    joinpath(zip_path, "lib64/python00.zip");
+     bufsz = strlen(zip_path); /* Replace "00" with version */
+     zip_path[bufsz - 6] = VERSION[0];
+     zip_path[bufsz - 5] = VERSION[2];
+@@ -534,7 +534,7 @@
+             fprintf(stderr,
+                 "Could not find platform dependent libraries <exec_prefix>\n");
+         strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);
+-        joinpath(exec_prefix, "lib/lib-dynload");
++        joinpath(exec_prefix, "lib64/lib-dynload");
+     }
+     /* If we found EXEC_PREFIX do *not* reduce it!  (Yet.) */
diff --git a/python/python-2.5-tkinter.patch b/python/python-2.5-tkinter.patch
new file mode 100644 (file)
index 0000000..f040ca1
--- /dev/null
@@ -0,0 +1,11 @@
+--- Python-2.5-orig/Modules/_tkinter.c 2006-08-11 22:33:36.000000000 -0400
++++ Python-2.5/Modules/_tkinter.c      2007-10-19 01:04:42.000000000 -0400
+@@ -938,7 +938,7 @@
+ #if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX == 3
+               Tcl_UniChar *outbuf;
+               Py_ssize_t i;
+-              assert(size < size * sizeof(Tcl_UniChar));
++              assert(size == 0 || size < size * sizeof(Tcl_UniChar));
+               outbuf = (Tcl_UniChar*)ckalloc(size * sizeof(Tcl_UniChar));
+               if (!outbuf) {
+                       PyErr_NoMemory();
diff --git a/python/python-2.5-xmlrpclib-marshal-objects.patch b/python/python-2.5-xmlrpclib-marshal-objects.patch
new file mode 100644 (file)
index 0000000..6930b73
--- /dev/null
@@ -0,0 +1,13 @@
+--- Python-2.5/Lib/xmlrpclib.py.orig   2007-04-10 10:29:14.000000000 -0400
++++ Python-2.5/Lib/xmlrpclib.py        2007-06-19 12:08:04.000000000 -0400
+@@ -630,6 +630,9 @@
+         try:
+             f = self.dispatch[type(value)]
+         except KeyError:
+-            raise TypeError, "cannot marshal %s objects" % type(value)
++            if isinstance(value, object):
++                self.dump_instance(value, write)
++            else:
++                raise TypeError, "cannot marshal %s objects" % type(value)
+         else:
+             f(self, value, write)
diff --git a/python/python-2.5.1-binutils-no-dep.patch b/python/python-2.5.1-binutils-no-dep.patch
new file mode 100644 (file)
index 0000000..7880eb6
--- /dev/null
@@ -0,0 +1,21 @@
+diff -rup Python-2.5.1-orig/Lib/ctypes/util.py Python-2.5.1/Lib/ctypes/util.py
+--- Python-2.5.1-orig/Lib/ctypes/util.py       2007-01-17 14:53:24.000000000 -0500
++++ Python-2.5.1/Lib/ctypes/util.py    2007-10-24 11:06:12.000000000 -0400
+@@ -71,9 +71,13 @@ elif os.name == "posix":
+         if not f:
+             return None
+         cmd = "objdump -p -j .dynamic 2>/dev/null " + f
+-        res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
++        try:
++            res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
++        except:
++            res = None
+         if not res:
+-            return None
++            return os.path.basename(f) # This is good for GLibc, I think, and a
++                                       # dep on binutils is big (for live CDs).
+         return res.group(1)
+     if (sys.platform.startswith("freebsd")
+Only in Python-2.5.1/Lib/ctypes: util.py~
+Only in Python-2.5.1/Lib/ctypes: util.py.binutils-no-dep
diff --git a/python/python-2.5.1-codec-ascii-tolower.patch b/python/python-2.5.1-codec-ascii-tolower.patch
new file mode 100644 (file)
index 0000000..81a123d
--- /dev/null
@@ -0,0 +1,25 @@
+diff -rup Python-2.5.1-orig/Python/codecs.c Python-2.5.1/Python/codecs.c
+--- Python-2.5.1-orig/Python/codecs.c  2006-06-23 17:16:18.000000000 -0400
++++ Python-2.5.1/Python/codecs.c       2007-10-30 12:51:10.000000000 -0400
+@@ -45,6 +45,11 @@ int PyCodec_Register(PyObject *search_fu
+     return -1;
+ }
++/* isupper() forced into the ASCII Locale */
++#define ascii_isupper(x) (((x) >= 0x41) && ((x) <= 0x5A))
++/* tolower() forced into the ASCII Locale */
++#define ascii_tolower(x) (ascii_isupper(x) ? ((x) + 0x20) : (x))
++
+ /* Convert a string to a normalized Python string: all characters are
+    converted to lower case, spaces are replaced with underscores. */
+@@ -70,7 +75,7 @@ PyObject *normalizestring(const char *st
+         if (ch == ' ')
+             ch = '-';
+         else
+-            ch = tolower(Py_CHARMASK(ch));
++            ch = ascii_tolower(Py_CHARMASK(ch));
+       p[i] = ch;
+     }
+     return v;
+Only in Python-2.5.1/Python: codecs.c~
diff --git a/python/python-2.5.1-ctypes-exec-stack.patch b/python/python-2.5.1-ctypes-exec-stack.patch
new file mode 100644 (file)
index 0000000..0f5c675
--- /dev/null
@@ -0,0 +1,44 @@
+diff -up Python-2.5.1/Modules/_ctypes/libffi/src/x86/unix64.S.execstack Python-2.5.1/Modules/_ctypes/libffi/src/x86/unix64.S
+--- Python-2.5.1/Modules/_ctypes/libffi/src/x86/unix64.S.execstack     2007-08-10 10:34:06.000000000 +0200
++++ Python-2.5.1/Modules/_ctypes/libffi/src/x86/unix64.S       2007-08-10 10:34:06.000000000 +0200
+@@ -410,3 +410,7 @@ ffi_closure_unix64:
+ .LEFDE3:
+ #endif /* __x86_64__ */
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
+diff -up Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/sysv.S.execstack Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/sysv.S
+--- Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/sysv.S.execstack   2007-08-10 10:39:03.000000000 +0200
++++ Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/sysv.S     2007-08-10 10:39:59.000000000 +0200
+@@ -215,3 +215,7 @@ END(ffi_call_SYSV)
+       .align 2
+ .LEFDE1:
+ #endif
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
+diff -up Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S.execstack Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S
+--- Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S.execstack        2007-08-10 10:39:23.000000000 +0200
++++ Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64_closure.S  2007-08-10 10:39:58.000000000 +0200
+@@ -204,3 +204,7 @@ ffi_closure_LINUX64:
+       .align 3
+ .LEFDE1:
+ #endif
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
+diff -up Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64.S.execstack Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64.S
+--- Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64.S.execstack        2007-08-10 10:39:13.000000000 +0200
++++ Python-2.5.1/Modules/_ctypes/libffi/src/powerpc/linux64.S  2007-08-10 10:40:01.000000000 +0200
+@@ -178,3 +178,7 @@ ffi_call_LINUX64:
+       .align 3
+ .LEFDE1:
+ #endif
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
diff --git a/python/python-2.5.1-db46.patch b/python/python-2.5.1-db46.patch
new file mode 100644 (file)
index 0000000..a1896e6
--- /dev/null
@@ -0,0 +1,33 @@
+diff -up Python-2.5.1/setup.py.db46 Python-2.5.1/setup.py
+--- Python-2.5.1/setup.py.db46 2007-08-14 12:53:45.000000000 -0400
++++ Python-2.5.1/setup.py      2007-08-14 14:11:08.000000000 -0400
+@@ -606,9 +606,9 @@ class PyBuildExt(build_ext):
+         # 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)
+         min_db_ver = (3, 3)
+-        db_setup_debug = False   # verbose debug prints from this script?
++        db_setup_debug = True    # verbose debug prints from this script?
+         # construct a list of paths to look for the header file in on
+         # top of the normal inc_dirs.
+@@ -623,7 +623,7 @@ class PyBuildExt(build_ext):
+             '/sw/include/db3',
+         ]
+         # 4.x minor number specific paths
+-        for x in (0,1,2,3,4,5):
++        for x in (0,1,2,3,4,5,6):
+             db_inc_paths.append('/usr/include/db4%d' % x)
+             db_inc_paths.append('/usr/include/db4.%d' % x)
+             db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
+@@ -646,7 +646,7 @@ class PyBuildExt(build_ext):
+         for dn in inc_dirs:
+             std_variants.append(os.path.join(dn, 'db3'))
+             std_variants.append(os.path.join(dn, 'db4'))
+-            for x in (0,1,2,3,4):
++            for x in (0,1,2,3,4,5,6):
+                 std_variants.append(os.path.join(dn, "db4%d"%x))
+                 std_variants.append(os.path.join(dn, "db4.%d"%x))
+             for x in (2,3):
diff --git a/python/python-2.5.1-db47.patch b/python/python-2.5.1-db47.patch
new file mode 100644 (file)
index 0000000..3ae8364
--- /dev/null
@@ -0,0 +1,93 @@
+diff -up Python-2.5.1/Modules/_bsddb.c.db46 Python-2.5.1/Modules/_bsddb.c
+--- Python-2.5.1/Modules/_bsddb.c.db46 2007-01-04 21:09:06.000000000 -0500
++++ Python-2.5.1/Modules/_bsddb.c      2008-07-10 09:58:55.000000000 -0400
+@@ -5306,11 +5306,13 @@ static PyObject*
+ DBEnv_getattr(DBEnvObject* self, char *name)
+ {
+     if (!strcmp(name, "db_home")) {
++      const char *home = NULL;
+         CHECK_ENV_NOT_CLOSED(self);
+-        if (self->db_env->db_home == NULL) {
++      self->db_env->get_home(self->db_env, &home);
++        if (home == NULL) {
+             RETURN_NONE();
+         }
+-        return PyString_FromString(self->db_env->db_home);
++        return PyString_FromString(home);
+     }
+     return Py_FindMethod(DBEnv_methods, (PyObject* )self, name);
+@@ -5932,22 +5934,37 @@ DL_EXPORT(void) init_bsddb(void)
+     ADD_INT(d, DB_TIME_NOTGRANTED);
+     ADD_INT(d, DB_TXN_NOT_DURABLE);
+     ADD_INT(d, DB_TXN_WRITE_NOSYNC);
+-    ADD_INT(d, DB_LOG_AUTOREMOVE);
+-    ADD_INT(d, DB_DIRECT_LOG);
+     ADD_INT(d, DB_DIRECT_DB);
+     ADD_INT(d, DB_INIT_REP);
+     ADD_INT(d, DB_ENCRYPT);
+     ADD_INT(d, DB_CHKSUM);
+ #endif
++#if (DBVER >= 42) && (DBVER < 47)
++    ADD_INT(d, DB_LOG_AUTOREMOVE);
++    ADD_INT(d, DB_DIRECT_LOG);
++#endif
++
++#if (DBVER >= 47)
++    ADD_INT(d, DB_LOG_DIRECT);
++    ADD_INT(d, DB_LOG_DSYNC);
++    ADD_INT(d, DB_LOG_IN_MEMORY);
++    ADD_INT(d, DB_LOG_AUTO_REMOVE);
++    ADD_INT(d, DB_LOG_ZERO);
++#endif
++
+ #if (DBVER >= 43)
+-    ADD_INT(d, DB_LOG_INMEMORY);
+     ADD_INT(d, DB_BUFFER_SMALL);
+     ADD_INT(d, DB_SEQ_DEC);
+     ADD_INT(d, DB_SEQ_INC);
+     ADD_INT(d, DB_SEQ_WRAP);
+ #endif
++#if (DBVER >= 43) && (DBVER < 47)
++    ADD_INT(d, DB_LOG_INMEMORY);
++    ADD_INT(d, DB_DSYNC_LOG);
++#endif
++
+ #if (DBVER >= 41)
+     ADD_INT(d, DB_ENCRYPT_AES);
+     ADD_INT(d, DB_AUTO_COMMIT);
+diff -up Python-2.5.1/setup.py.db46 Python-2.5.1/setup.py
+--- Python-2.5.1/setup.py.db46 2008-07-10 09:55:08.000000000 -0400
++++ Python-2.5.1/setup.py      2008-07-10 09:55:08.000000000 -0400
+@@ -606,9 +606,9 @@ class PyBuildExt(build_ext):
+         # 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, 7)
+         min_db_ver = (3, 3)
+-        db_setup_debug = False   # verbose debug prints from this script?
++        db_setup_debug = True    # verbose debug prints from this script?
+         # construct a list of paths to look for the header file in on
+         # top of the normal inc_dirs.
+@@ -623,7 +623,7 @@ class PyBuildExt(build_ext):
+             '/sw/include/db3',
+         ]
+         # 4.x minor number specific paths
+-        for x in (0,1,2,3,4,5):
++        for x in (0,1,2,3,4,5,6,7):
+             db_inc_paths.append('/usr/include/db4%d' % x)
+             db_inc_paths.append('/usr/include/db4.%d' % x)
+             db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
+@@ -646,7 +646,7 @@ class PyBuildExt(build_ext):
+         for dn in inc_dirs:
+             std_variants.append(os.path.join(dn, 'db3'))
+             std_variants.append(os.path.join(dn, 'db4'))
+-            for x in (0,1,2,3,4):
++            for x in (0,1,2,3,4,5,6,7):
+                 std_variants.append(os.path.join(dn, "db4%d"%x))
+                 std_variants.append(os.path.join(dn, "db4.%d"%x))
+             for x in (2,3):
diff --git a/python/python-2.5.1-listdir.patch b/python/python-2.5.1-listdir.patch
new file mode 100644 (file)
index 0000000..1c4fc3f
--- /dev/null
@@ -0,0 +1,18 @@
+--- Python-2.5.1/Modules/posixmodule.c.orig    2007-04-04 14:30:56.000000000 -0400
++++ Python-2.5.1/Modules/posixmodule.c 2008-06-14 17:35:47.000000000 -0400
+@@ -2160,7 +2160,6 @@
+       struct dirent *ep;
+       int arg_is_unicode = 1;
+-      errno = 0;
+       if (!PyArg_ParseTuple(args, "U:listdir", &v)) {
+               arg_is_unicode = 0;
+               PyErr_Clear();
+@@ -2176,6 +2175,7 @@
+               return NULL;
+       }
+       for (;;) {
++              errno = 0;
+               Py_BEGIN_ALLOW_THREADS
+               ep = readdir(dirp);
+               Py_END_ALLOW_THREADS
diff --git a/python/python-2.5.1-plural-fix.patch b/python/python-2.5.1-plural-fix.patch
new file mode 100644 (file)
index 0000000..040adaf
--- /dev/null
@@ -0,0 +1,12 @@
+diff -up Python-2.5.1/Lib/gettext.py.plural Python-2.5.1/Lib/gettext.py
+--- Python-2.5.1/Lib/gettext.py.plural 2007-09-10 11:38:57.000000000 -0400
++++ Python-2.5.1/Lib/gettext.py        2007-09-10 11:39:00.000000000 -0400
+@@ -299,6 +299,8 @@ class GNUTranslations(NullTranslations):
+                     item = item.strip()
+                     if not item:
+                         continue
++                    if item.startswith("#"):
++                        continue
+                     if ':' in item:
+                         k, v = item.split(':', 1)
+                         k = k.strip().lower()
diff --git a/python/python-2.5.1-pysqlite.patch b/python/python-2.5.1-pysqlite.patch
new file mode 100644 (file)
index 0000000..ce4f936
--- /dev/null
@@ -0,0 +1,33 @@
+diff -up Python-2.5.1/Modules/_sqlite/cache.h.pysqlite Python-2.5.1/Modules/_sqlite/cache.h
+--- Python-2.5.1/Modules/_sqlite/cache.h.pysqlite      2006-04-23 16:24:26.000000000 +0100
++++ Python-2.5.1/Modules/_sqlite/cache.h       2007-10-25 11:21:31.000000000 +0100
+@@ -64,7 +64,7 @@ extern PyTypeObject CacheType;
+ int node_init(Node* self, PyObject* args, PyObject* kwargs);
+ void node_dealloc(Node* self);
+-int cache_init(Cache* self, PyObject* args, PyObject* kwargs);
++int pysqlite_cache_init(Cache* self, PyObject* args, PyObject* kwargs);
+ void cache_dealloc(Cache* self);
+ PyObject* cache_get(Cache* self, PyObject* args);
+diff -up Python-2.5.1/Modules/_sqlite/cache.c.pysqlite Python-2.5.1/Modules/_sqlite/cache.c
+--- Python-2.5.1/Modules/_sqlite/cache.c.pysqlite      2006-04-23 16:24:26.000000000 +0100
++++ Python-2.5.1/Modules/_sqlite/cache.c       2007-10-25 11:22:10.000000000 +0100
+@@ -54,7 +54,7 @@ void node_dealloc(Node* self)
+     self->ob_type->tp_free((PyObject*)self);
+ }
+-int cache_init(Cache* self, PyObject* args, PyObject* kwargs)
++int pysqlite_cache_init(Cache* self, PyObject* args, PyObject* kwargs)
+ {
+     PyObject* factory;
+     int size = 10;
+@@ -352,7 +352,7 @@ PyTypeObject CacheType = {
+         0,                                              /* tp_descr_get */
+         0,                                              /* tp_descr_set */
+         0,                                              /* tp_dictoffset */
+-        (initproc)cache_init,                           /* tp_init */
++        (initproc)pysqlite_cache_init,                  /* tp_init */
+         0,                                              /* tp_alloc */
+         0,                                              /* tp_new */
+         0                                               /* tp_free */
diff --git a/python/python-2.5.1-socketmodule-constants.patch b/python/python-2.5.1-socketmodule-constants.patch
new file mode 100644 (file)
index 0000000..9dd1579
--- /dev/null
@@ -0,0 +1,63 @@
+--- Python-2.5.1i-orig/Modules/socketmodule.c  2008-03-07 16:38:47.000000000 -0500
++++ Python-2.5.1/Modules/socketmodule.c        2008-03-07 16:41:09.000000000 -0500
+@@ -4507,6 +4507,60 @@
+ #ifdef        SO_TYPE
+       PyModule_AddIntConstant(m, "SO_TYPE", SO_TYPE);
+ #endif
++#ifdef        SO_SNDBUFFORCE
++      PyModule_AddIntConstant(m, "SO_SNDBUFFORCE", SO_SNDBUFFORCE);
++#endif
++#ifdef        SO_RCVBUFFORCE
++      PyModule_AddIntConstant(m, "SO_RCVBUFFORCE", SO_RCVBUFFORCE);
++#endif
++#ifdef        SO_NO_CHECK
++      PyModule_AddIntConstant(m, "SO_NO_CHECK", SO_NO_CHECK);
++#endif
++#ifdef        SO_PRIORITY
++      PyModule_AddIntConstant(m, "SO_PRIORITY", SO_PRIORITY);
++#endif
++#ifdef        SO_BSDCOMPAT
++      PyModule_AddIntConstant(m, "SO_BSDCOMPAT", SO_BSDCOMPAT);
++#endif
++#ifdef        SO_PASSCRED
++      PyModule_AddIntConstant(m, "SO_PASSCRED", SO_PASSCRED);
++#endif
++#ifdef        SO_PEERCRED
++      PyModule_AddIntConstant(m, "SO_PEERCRED", SO_PEERCRED);
++#endif
++#ifdef        SO_SECURITY_AUTHENTICATION
++      PyModule_AddIntConstant(m, "SO_SECURITY_AUTHENTICATION", SO_SECURITY_AUTHENTICATION);
++#endif
++#ifdef        SO_SECURITY_ENCRYPTION_TRANSPORT
++      PyModule_AddIntConstant(m, "SO_SECURITY_ENCRYPTION_TRANSPORT", SO_SECURITY_ENCRYPTION_TRANSPORT);
++#endif
++#ifdef        SO_SECURITY_ENCRYPTION_NETWORK
++      PyModule_AddIntConstant(m, "SO_SECURITY_ENCRYPTION_NETWORK", SO_SECURITY_ENCRYPTION_NETWORK);
++#endif
++#ifdef        SO_BINDTODEVICE
++      PyModule_AddIntConstant(m, "SO_BINDTODEVICE", SO_BINDTODEVICE);
++#endif
++#ifdef        SO_ATTACH_FILTER
++      PyModule_AddIntConstant(m, "SO_ATTACH_FILTER", SO_ATTACH_FILTER);
++#endif
++#ifdef        SO_DETACH_FILTER
++      PyModule_AddIntConstant(m, "SO_DETACH_FILTER", SO_DETACH_FILTER);
++#endif
++#ifdef        SO_PEERNAME
++      PyModule_AddIntConstant(m, "SO_PEERNAME", SO_PEERNAME);
++#endif
++#ifdef        SO_TIMESTAMP
++      PyModule_AddIntConstant(m, "SO_TIMESTAMP", SO_TIMESTAMP);
++#endif
++#ifdef        SO_PEERSEC
++      PyModule_AddIntConstant(m, "SO_PEERSEC", SO_PEERSEC);
++#endif
++#ifdef        SO_PASSSEC
++      PyModule_AddIntConstant(m, "SO_PASSSEC", SO_PASSSEC);
++#endif
++#ifdef        SO_TIMESTAMPNS
++      PyModule_AddIntConstant(m, "SO_TIMESTAMPNS", SO_TIMESTAMPNS);
++#endif
+       /* Maximum number of connections for "listen" */
+ #ifdef        SOMAXCONN
diff --git a/python/python-2.5.1-socketmodule-constants2.patch b/python/python-2.5.1-socketmodule-constants2.patch
new file mode 100644 (file)
index 0000000..93008b9
--- /dev/null
@@ -0,0 +1,20 @@
+diff -rup Python-2.5.1-orig/Modules/socketmodule.c Python-2.5.1/Modules/socketmodule.c
+--- Python-2.5.1-orig/Modules/socketmodule.c   2008-03-25 09:59:38.000000000 -0400
++++ Python-2.5.1/Modules/socketmodule.c        2008-03-25 10:12:24.000000000 -0400
+@@ -4977,6 +4977,15 @@ init_socket(void)
+ #ifdef        TCP_QUICKACK
+       PyModule_AddIntConstant(m, "TCP_QUICKACK", TCP_QUICKACK);
+ #endif
++#ifdef        TCP_CONGESTION
++      PyModule_AddIntConstant(m, "TCP_CONGESTION", TCP_CONGESTION);
++#endif
++#ifdef        TCP_MD5SIG
++      PyModule_AddIntConstant(m, "TCP_MD5SIG", TCP_MD5SIG);
++#endif
++#ifdef        TCP_MD5SIG_MAXKEYLEN
++      PyModule_AddIntConstant(m, "TCP_MD5SIG_MAXKEYLEN", TCP_MD5SIG_MAXKEYLEN);
++#endif
+       /* IPX options */
+Only in Python-2.5.1/Modules: socketmodule.c~
diff --git a/python/python-2.5.1-sqlite-encoding.patch b/python/python-2.5.1-sqlite-encoding.patch
new file mode 100644 (file)
index 0000000..97235d8
--- /dev/null
@@ -0,0 +1,24 @@
+diff -up Python-2.5.1/Lib/sqlite3/dbapi2.py.encoding Python-2.5.1/Lib/sqlite3/dbapi2.py
+--- Python-2.5.1/Lib/sqlite3/dbapi2.py.encoding        2007-09-14 10:41:50.000000000 -0400
++++ Python-2.5.1/Lib/sqlite3/dbapi2.py 2007-09-14 10:42:00.000000000 -0400
+@@ -1,7 +1,6 @@
+-#-*- coding: ISO-8859-1 -*-
+ # pysqlite2/dbapi2.py: the DB-API 2.0 interface
+ #
+-# Copyright (C) 2004-2005 Gerhard Häring <gh@ghaering.de>
++# Copyright (C) 2004-2005 Gerhard Haering <gh@ghaering.de>
+ #
+ # This file is part of pysqlite.
+ #
+diff -up Python-2.5.1/Lib/sqlite3/__init__.py.encoding Python-2.5.1/Lib/sqlite3/__init__.py
+--- Python-2.5.1/Lib/sqlite3/__init__.py.encoding      2007-09-14 10:41:47.000000000 -0400
++++ Python-2.5.1/Lib/sqlite3/__init__.py       2007-09-14 10:42:06.000000000 -0400
+@@ -1,7 +1,6 @@
+-#-*- coding: ISO-8859-1 -*-
+ # pysqlite2/__init__.py: the pysqlite2 package.
+ #
+-# Copyright (C) 2005 Gerhard Häring <gh@ghaering.de>
++# Copyright (C) 2005 Gerhard Haering <gh@ghaering.de>
+ #
+ # This file is part of pysqlite.
+ #
diff --git a/python/python-2.5.2-binutils-no-dep.patch b/python/python-2.5.2-binutils-no-dep.patch
new file mode 100644 (file)
index 0000000..6792c9f
--- /dev/null
@@ -0,0 +1,20 @@
+diff -ru Python-2.5.2-orig/Lib/ctypes/util.py Python-2.5.2/Lib/ctypes/util.py
+--- Python-2.5.2-orig/Lib/ctypes/util.py       2007-09-14 16:05:26.000000000 -0400
++++ Python-2.5.2/Lib/ctypes/util.py    2008-09-24 17:30:06.000000000 -0400
+@@ -83,9 +83,14 @@
+             if not f:
+                 return None
+             cmd = "objdump -p -j .dynamic 2>/dev/null " + f
+-            res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
++            try:
++                res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
++            except:
++                res = None
+             if not res:
+-                return None
++                return os.path.basename(f) #  This is good for GLibc, I think,
++                                           # and a dep on binutils is big (for
++                                           # live CDs).
+             return res.group(1)
+     if (sys.platform.startswith("freebsd")
diff --git a/python/python-2.5.2-db47.patch b/python/python-2.5.2-db47.patch
new file mode 100644 (file)
index 0000000..5dd3af2
--- /dev/null
@@ -0,0 +1,78 @@
+diff -ru Python-2.5.2-orig/Modules/_bsddb.c Python-2.5.2/Modules/_bsddb.c
+--- Python-2.5.2-orig/Modules/_bsddb.c 2008-02-03 02:26:23.000000000 -0500
++++ Python-2.5.2/Modules/_bsddb.c      2008-09-24 17:01:50.000000000 -0400
+@@ -5335,11 +5335,13 @@
+ DBEnv_getattr(DBEnvObject* self, char *name)
+ {
+     if (!strcmp(name, "db_home")) {
++      const char *home = NULL;
+         CHECK_ENV_NOT_CLOSED(self);
+-        if (self->db_env->db_home == NULL) {
++      self->db_env->get_home(self->db_env, &home);
++        if (home == NULL) {
+             RETURN_NONE();
+         }
+-        return PyString_FromString(self->db_env->db_home);
++        return PyString_FromString(home);
+     }
+     return Py_FindMethod(DBEnv_methods, (PyObject* )self, name);
+@@ -5961,22 +5963,37 @@
+     ADD_INT(d, DB_TIME_NOTGRANTED);
+     ADD_INT(d, DB_TXN_NOT_DURABLE);
+     ADD_INT(d, DB_TXN_WRITE_NOSYNC);
+-    ADD_INT(d, DB_LOG_AUTOREMOVE);
+-    ADD_INT(d, DB_DIRECT_LOG);
+     ADD_INT(d, DB_DIRECT_DB);
+     ADD_INT(d, DB_INIT_REP);
+     ADD_INT(d, DB_ENCRYPT);
+     ADD_INT(d, DB_CHKSUM);
+ #endif
++#if (DBVER >= 42) && (DBVER < 47)
++    ADD_INT(d, DB_LOG_AUTOREMOVE);
++    ADD_INT(d, DB_DIRECT_LOG);
++#endif
++
++#if (DBVER >= 47)
++    ADD_INT(d, DB_LOG_DIRECT);
++    ADD_INT(d, DB_LOG_DSYNC);
++    ADD_INT(d, DB_LOG_IN_MEMORY);
++    ADD_INT(d, DB_LOG_AUTO_REMOVE);
++    ADD_INT(d, DB_LOG_ZERO);
++#endif
++
+ #if (DBVER >= 43)
+-    ADD_INT(d, DB_LOG_INMEMORY);
+     ADD_INT(d, DB_BUFFER_SMALL);
+     ADD_INT(d, DB_SEQ_DEC);
+     ADD_INT(d, DB_SEQ_INC);
+     ADD_INT(d, DB_SEQ_WRAP);
+ #endif
++#if (DBVER >= 43) && (DBVER < 47)
++    ADD_INT(d, DB_LOG_INMEMORY);
++    ADD_INT(d, DB_DSYNC_LOG);
++#endif
++
+ #if (DBVER >= 41)
+     ADD_INT(d, DB_ENCRYPT_AES);
+     ADD_INT(d, DB_AUTO_COMMIT);
+diff -ru Python-2.5.2-orig/setup.py Python-2.5.2/setup.py
+--- Python-2.5.2-orig/setup.py 2008-09-24 17:01:02.000000000 -0400
++++ Python-2.5.2/setup.py      2008-09-24 17:03:05.000000000 -0400
+@@ -608,12 +608,12 @@
+         # 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, 7)
+         # 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.
+         min_db_ver = (3, 3)
+-        db_setup_debug = False   # verbose debug prints from this script?
++        db_setup_debug = True   # verbose debug prints from this script?
+         # construct a list of paths to look for the header file in on
+         # top of the normal inc_dirs.
diff --git a/python/python-2.5.2-set_wakeup_fd4.patch b/python/python-2.5.2-set_wakeup_fd4.patch
new file mode 100644 (file)
index 0000000..77ae208
--- /dev/null
@@ -0,0 +1,86 @@
+diff -ru Python-2.5.2-orig/Modules/signalmodule.c Python-2.5.2/Modules/signalmodule.c
+--- Python-2.5.2-orig/Modules/signalmodule.c   2007-12-10 18:03:55.000000000 -0500
++++ Python-2.5.2/Modules/signalmodule.c        2008-09-24 17:32:45.000000000 -0400
+@@ -12,6 +12,8 @@
+ #include <signal.h>
++#include <sys/stat.h>
++
+ #ifndef SIG_ERR
+ #define SIG_ERR ((PyOS_sighandler_t)(-1))
+ #endif
+@@ -75,6 +77,8 @@
+         PyObject *func;
+ } Handlers[NSIG];
++static int wakeup_fd = -1;
++
+ /* Speed up sigcheck() when none tripped */
+ static volatile sig_atomic_t is_tripped = 0;
+@@ -113,6 +117,7 @@
+ static void
+ signal_handler(int sig_num)
+ {
++      const char dummy_byte = '\0';
+ #ifdef WITH_THREAD
+ #ifdef WITH_PTH
+       if (PyThread_get_thread_ident() != main_thread) {
+@@ -128,6 +133,8 @@
+                    cleared in PyErr_CheckSignals() before .tripped. */
+               is_tripped = 1;
+               Py_AddPendingCall(checksignals_witharg, NULL);
++              if (wakeup_fd != -1)
++                      write(wakeup_fd, &dummy_byte, 1);
+ #ifdef WITH_THREAD
+       }
+ #endif
+@@ -267,6 +274,39 @@
+ anything else -- the callable Python object used as a handler");
++static PyObject *
++signal_set_wakeup_fd(PyObject *self, PyObject *args)
++{
++      struct stat buf;
++      int fd, old_fd;
++      if (!PyArg_ParseTuple(args, "i:set_wakeup_fd", &fd))
++              return NULL;
++#ifdef WITH_THREAD
++      if (PyThread_get_thread_ident() != main_thread) {
++              PyErr_SetString(PyExc_ValueError,
++                              "set_wakeup_fd only works in main thread");
++              return NULL;
++      }
++#endif
++      if (fd != -1 && fstat(fd, &buf) != 0) {
++              PyErr_SetString(PyExc_ValueError, "invalid fd");
++              return NULL;
++      }
++      old_fd = wakeup_fd;
++      wakeup_fd = fd;
++      return PyLong_FromLong(old_fd);
++}
++
++PyDoc_STRVAR(set_wakeup_fd_doc,
++"set_wakeup_fd(fd) -> fd\n\
++\n\
++Sets the fd to be written to (with '\\0') when a signal\n\
++comes in.  A library can use this to wakeup select or poll.\n\
++The previous fd is returned.\n\
++\n\
++The fd must be non-blocking.");
++
++
+ /* List of functions defined in the module */
+ static PyMethodDef signal_methods[] = {
+ #ifdef HAVE_ALARM
+@@ -274,6 +314,7 @@
+ #endif
+       {"signal",              signal_signal, METH_VARARGS, signal_doc},
+       {"getsignal",           signal_getsignal, METH_VARARGS, getsignal_doc},
++      {"set_wakeup_fd",       signal_set_wakeup_fd, METH_VARARGS, set_wakeup_fd_doc},
+ #ifdef HAVE_PAUSE
+       {"pause",               (PyCFunction)signal_pause,
+        METH_NOARGS,pause_doc},
diff --git a/python/python-2.5.CVE-2007-4965-int-overflow.patch b/python/python-2.5.CVE-2007-4965-int-overflow.patch
new file mode 100644 (file)
index 0000000..ad26707
--- /dev/null
@@ -0,0 +1,221 @@
+diff -ru Python-2.5-orig/Modules/imageop.c Python-2.5/Modules/imageop.c
+--- Python-2.5-orig/Modules/imageop.c  2006-01-19 01:09:39.000000000 -0500
++++ Python-2.5/Modules/imageop.c       2007-10-19 01:11:33.000000000 -0400
+@@ -78,7 +78,7 @@
+       char *cp, *ncp;
+       short *nsp;
+       Py_Int32 *nlp;
+-      int len, size, x, y, newx1, newx2, newy1, newy2;
++      int len, size, x, y, newx1, newx2, newy1, newy2, nlen;
+       int ix, iy, xstep, ystep;
+       PyObject *rv;
+@@ -90,13 +90,19 @@
+               PyErr_SetString(ImageopError, "Size should be 1, 2 or 4");
+               return 0;
+       }
+-      if ( len != size*x*y ) {
++      if (( len != size*x*y ) ||
++            ( size != ((len / x) / y) )) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+       }
+       xstep = (newx1 < newx2)? 1 : -1;
+       ystep = (newy1 < newy2)? 1 : -1;
+     
++        nlen = (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size;
++        if ( size != ((nlen / (abs(newx2-newx1)+1)) / (abs(newy2-newy1)+1)) ) {
++              PyErr_SetString(ImageopError, "String has incorrect length");
++              return 0;
++      }
+       rv = PyString_FromStringAndSize(NULL,
+                            (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size);
+       if ( rv == 0 )
+@@ -132,7 +138,7 @@
+       char *cp, *ncp;
+       short *nsp;
+       Py_Int32 *nlp;
+-      int len, size, x, y, newx, newy;
++      int len, size, x, y, newx, newy, nlen;
+       int ix, iy;
+       int oix, oiy;
+       PyObject *rv;
+@@ -145,12 +151,18 @@
+               PyErr_SetString(ImageopError, "Size should be 1, 2 or 4");
+               return 0;
+       }
+-      if ( len != size*x*y ) {
++      if ( ( len != size*x*y ) ||
++             ( size != ((len / x) / y) ) ) {
++              PyErr_SetString(ImageopError, "String has incorrect length");
++              return 0;
++      }
++        nlen = newx*newy*size;
++      if ( size != ((nlen / newx) / newy) ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+       }
+     
+-      rv = PyString_FromStringAndSize(NULL, newx*newy*size);
++      rv = PyString_FromStringAndSize(NULL, nlen);
+       if ( rv == 0 )
+               return 0;
+       ncp = (char *)PyString_AsString(rv);
+@@ -190,7 +202,8 @@
+               PyErr_SetString(ImageopError, "Size should be 1 or 4");
+               return 0;
+       }
+-      if ( maxx*maxy*width != len ) {
++      if ( ( maxx*maxy*width != len ) ||
++             ( maxx != ((len / maxy) / width) ) ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+       }
+@@ -240,7 +253,8 @@
+       if ( !PyArg_ParseTuple(args, "s#iii", &cp, &len, &x, &y, &tres) )
+               return 0;
+-      if ( x*y != len ) {
++      if ( ( x*y != len ) ||
++             ( x != len / y ) ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+       }
+@@ -281,7 +295,8 @@
+       if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
+               return 0;
+-      if ( x*y != len ) {
++      if ( ( x*y != len ) ||
++             ( x != len / y ) ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+       }
+@@ -320,7 +335,8 @@
+       if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
+               return 0;
+-      if ( x*y != len ) {
++      if ( ( x*y != len ) ||
++             ( x != len / y ) ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+       }
+@@ -358,7 +374,8 @@
+       if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
+               return 0;
+-      if ( x*y != len ) {
++      if ( ( x*y != len ) ||
++             ( x != len / y ) ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+       }
+@@ -404,7 +421,8 @@
+       if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
+               return 0;
+-      if ( x*y != len ) {
++      if ( ( x*y != len ) ||
++             ( x != len / y ) ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+       }
+@@ -443,7 +461,11 @@
+       if ( !PyArg_ParseTuple(args, "s#iiii", &cp, &len, &x, &y, &v0, &v1) )
+               return 0;
+-      nlen = x*y;
++        nlen = x*y;
++      if ( x != (nlen / y) ) {
++              PyErr_SetString(ImageopError, "String has incorrect length");
++              return 0;
++      }
+       if ( (nlen+7)/8 != len ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+@@ -481,6 +503,10 @@
+               return 0;
+       nlen = x*y;
++      if ( x != (nlen / y) ) {
++              PyErr_SetString(ImageopError, "String has incorrect length");
++              return 0;
++      }
+       if ( (nlen+3)/4 != len ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+@@ -517,6 +543,10 @@
+               return 0;
+       nlen = x*y;
++      if ( x != (nlen / y) ) {
++              PyErr_SetString(ImageopError, "String has incorrect length");
++              return 0;
++      }
+       if ( (nlen+1)/2 != len ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+@@ -554,6 +584,10 @@
+               return 0;
+       nlen = x*y;
++      if ( x != (nlen / y) ) {
++              PyErr_SetString(ImageopError, "String has incorrect length");
++              return 0;
++      }
+       if ( nlen*4 != len ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+@@ -598,6 +632,10 @@
+               return 0;
+       nlen = x*y;
++      if ( x != (nlen / y) ) {
++              PyErr_SetString(ImageopError, "String has incorrect length");
++              return 0;
++      }
+       if ( nlen != len ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+@@ -648,6 +686,10 @@
+               return 0;
+       nlen = x*y;
++      if ( x != (nlen / y) ) {
++              PyErr_SetString(ImageopError, "String has incorrect length");
++              return 0;
++      }
+       if ( nlen*4 != len ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+@@ -693,6 +735,10 @@
+               return 0;
+       nlen = x*y;
++      if ( x != (nlen / y) ) {
++              PyErr_SetString(ImageopError, "String has incorrect length");
++              return 0;
++      }
+       if ( nlen != len ) {
+               PyErr_SetString(ImageopError, "String has incorrect length");
+               return 0;
+Only in Python-2.5/Modules: imageop.c~
+Only in Python-2.5/Modules: imageop.c.cve2007-4965
+diff -ru Python-2.5-orig/Modules/rgbimgmodule.c Python-2.5/Modules/rgbimgmodule.c
+--- Python-2.5-orig/Modules/rgbimgmodule.c     2006-08-11 23:18:50.000000000 -0400
++++ Python-2.5/Modules/rgbimgmodule.c  2007-10-19 01:05:44.000000000 -0400
+@@ -299,6 +299,11 @@
+       xsize = image.xsize;
+       ysize = image.ysize;
+       zsize = image.zsize;
++      tablen = xsize * ysize * zsize * sizeof(Py_Int32);
++        if (xsize != (((tablen / ysize) / zsize) / sizeof(Py_Int32))) {
++              PyErr_NoMemory();
++              goto finally;
++        }
+       if (rle) {
+               tablen = ysize * zsize * sizeof(Py_Int32);
+               starttab = (Py_Int32 *)malloc(tablen);
+Only in Python-2.5/Modules: rgbimgmodule.c.cve2007-4965
+Only in Python-2.5/Modules: _tkinter.c.tkinter
diff --git a/python/python2.6-set_wakeup_fd4.patch b/python/python2.6-set_wakeup_fd4.patch
new file mode 100644 (file)
index 0000000..76920a1
--- /dev/null
@@ -0,0 +1,86 @@
+diff -rup Python-2.5.1-orig/Modules/signalmodule.c Python-2.5.1/Modules/signalmodule.c
+--- Python-2.5.1-orig/Modules/signalmodule.c   2006-01-19 01:09:39.000000000 -0500
++++ Python-2.5.1/Modules/signalmodule.c        2008-01-07 12:32:00.000000000 -0500
+@@ -12,6 +12,8 @@
+ #include <signal.h>
++#include <sys/stat.h>
++
+ #ifndef SIG_ERR
+ #define SIG_ERR ((PyOS_sighandler_t)(-1))
+ #endif
+@@ -75,6 +77,8 @@ static struct {
+         PyObject *func;
+ } Handlers[NSIG];
++static int wakeup_fd = -1;
++
+ static int is_tripped = 0; /* Speed up sigcheck() when none tripped */
+ static PyObject *DefaultHandler;
+@@ -112,6 +116,7 @@ checksignals_witharg(void * unused)
+ static void
+ signal_handler(int sig_num)
+ {
++      const char dummy_byte = '\0';
+ #ifdef WITH_THREAD
+ #ifdef WITH_PTH
+       if (PyThread_get_thread_ident() != main_thread) {
+@@ -125,6 +130,8 @@ signal_handler(int sig_num)
+               is_tripped++;
+               Handlers[sig_num].tripped = 1;
+               Py_AddPendingCall(checksignals_witharg, NULL);
++              if (wakeup_fd != -1)
++                      write(wakeup_fd, &dummy_byte, 1);
+ #ifdef WITH_THREAD
+       }
+ #endif
+@@ -264,6 +271,39 @@ None -- if an unknown handler is in effe
+ anything else -- the callable Python object used as a handler");
++static PyObject *
++signal_set_wakeup_fd(PyObject *self, PyObject *args)
++{
++      struct stat buf;
++      int fd, old_fd;
++      if (!PyArg_ParseTuple(args, "i:set_wakeup_fd", &fd))
++              return NULL;
++#ifdef WITH_THREAD
++      if (PyThread_get_thread_ident() != main_thread) {
++              PyErr_SetString(PyExc_ValueError,
++                              "set_wakeup_fd only works in main thread");
++              return NULL;
++      }
++#endif
++      if (fd != -1 && fstat(fd, &buf) != 0) {
++              PyErr_SetString(PyExc_ValueError, "invalid fd");
++              return NULL;
++      }
++      old_fd = wakeup_fd;
++      wakeup_fd = fd;
++      return PyLong_FromLong(old_fd);
++}
++
++PyDoc_STRVAR(set_wakeup_fd_doc,
++"set_wakeup_fd(fd) -> fd\n\
++\n\
++Sets the fd to be written to (with '\\0') when a signal\n\
++comes in.  A library can use this to wakeup select or poll.\n\
++The previous fd is returned.\n\
++\n\
++The fd must be non-blocking.");
++
++
+ /* List of functions defined in the module */
+ static PyMethodDef signal_methods[] = {
+ #ifdef HAVE_ALARM
+@@ -271,6 +311,7 @@ static PyMethodDef signal_methods[] = {
+ #endif
+       {"signal",              signal_signal, METH_VARARGS, signal_doc},
+       {"getsignal",           signal_getsignal, METH_VARARGS, getsignal_doc},
++      {"set_wakeup_fd",       signal_set_wakeup_fd, METH_VARARGS, set_wakeup_fd_doc},
+ #ifdef HAVE_PAUSE
+       {"pause",               (PyCFunction)signal_pause,
+        METH_NOARGS,pause_doc},