aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/python/python-2.7.1
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2010-12-28 02:59:45 +0000
committerKhem Raj <raj.khem@gmail.com>2011-01-07 14:42:31 -0800
commit412ab1b8234785f3c19f545bd5041b74169b167f (patch)
treef360387ce155ea91e27422a7ed778608e0dc200a /recipes/python/python-2.7.1
parentc65ccdbe7c6f5c283a31b182931cddb5aa07fcd0 (diff)
downloadopenembedded-412ab1b8234785f3c19f545bd5041b74169b167f.tar.gz
python: Initial commit of python 2.7.1
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'recipes/python/python-2.7.1')
-rw-r--r--recipes/python/python-2.7.1/00-fix-bindir-libdir-for-cross.patch20
-rw-r--r--recipes/python/python-2.7.1/01-fix-have-long-long-format.patch19
-rw-r--r--recipes/python/python-2.7.1/01-use-proper-tools-for-cross-build.patch169
-rw-r--r--recipes/python/python-2.7.1/02-remove-test-for-cross.patch108
-rw-r--r--recipes/python/python-2.7.1/03-fix-tkinter-detection.patch40
-rw-r--r--recipes/python/python-2.7.1/04-default-is-optimized.patch18
-rw-r--r--recipes/python/python-2.7.1/05-enable-ctypes-cross-build.patch28
-rw-r--r--recipes/python/python-2.7.1/06-ctypes-libffi-fix-configure.patch44
-rw-r--r--recipes/python/python-2.7.1/10-distutils-fix-swig-parameter.patch16
-rw-r--r--recipes/python/python-2.7.1/11-distutils-never-modify-shebang-line.patch18
-rw-r--r--recipes/python/python-2.7.1/12-distutils-prefix-is-inside-staging-area.patch60
-rw-r--r--recipes/python/python-2.7.1/99-ignore-optimization-flag.patch19
-rw-r--r--recipes/python/python-2.7.1/debug.patch27
-rw-r--r--recipes/python/python-2.7.1/nohostlibs.patch29
-rw-r--r--recipes/python/python-2.7.1/sitecustomize.py45
15 files changed, 660 insertions, 0 deletions
diff --git a/recipes/python/python-2.7.1/00-fix-bindir-libdir-for-cross.patch b/recipes/python/python-2.7.1/00-fix-bindir-libdir-for-cross.patch
new file mode 100644
index 0000000000..2559e3a0e4
--- /dev/null
+++ b/recipes/python/python-2.7.1/00-fix-bindir-libdir-for-cross.patch
@@ -0,0 +1,20 @@
+# $(exec_prefix) points to the wrong directory, when installing
+# a cross-build. @bindir@ and @libdir@ works better and doesn't
+# affect the native build.
+# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>
+
+Index: Python-2.6.1/Makefile.pre.in
+===================================================================
+--- Python-2.6.1.orig/Makefile.pre.in
++++ Python-2.6.1/Makefile.pre.in
+@@ -86,8 +86,8 @@ exec_prefix= @exec_prefix@
+ datarootdir= @datarootdir@
+
+ # Expanded directories
+-BINDIR= $(exec_prefix)/bin
+-LIBDIR= $(exec_prefix)/lib
++BINDIR= @bindir@
++LIBDIR= @libdir@
+ MANDIR= @mandir@
+ INCLUDEDIR= @includedir@
+ CONFINCLUDEDIR= $(exec_prefix)/include
diff --git a/recipes/python/python-2.7.1/01-fix-have-long-long-format.patch b/recipes/python/python-2.7.1/01-fix-have-long-long-format.patch
new file mode 100644
index 0000000000..6cf3cd4959
--- /dev/null
+++ b/recipes/python/python-2.7.1/01-fix-have-long-long-format.patch
@@ -0,0 +1,19 @@
+# The configure script assumes the %lld printf format is not available as it
+# can't run its check script. For some reason python refuses to compile without
+# this functionality, so we just assume that our printf supports %lld.
+#
+# Include/pyport.h:243:13: error: #error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG"
+
+Index: Python-2.7.1/configure.in
+===================================================================
+--- Python-2.7.1.orig/configure.in
++++ Python-2.7.1/configure.in
+@@ -4151,7 +4151,7 @@ then
+ ]]])],
+ [ac_cv_have_long_long_format=yes],
+ [ac_cv_have_long_long_format=no],
+- [ac_cv_have_long_long_format=no])
++ [ac_cv_have_long_long_format=yes])
+ )
+ AC_MSG_RESULT($ac_cv_have_long_long_format)
+ fi
diff --git a/recipes/python/python-2.7.1/01-use-proper-tools-for-cross-build.patch b/recipes/python/python-2.7.1/01-use-proper-tools-for-cross-build.patch
new file mode 100644
index 0000000000..8420eb3967
--- /dev/null
+++ b/recipes/python/python-2.7.1/01-use-proper-tools-for-cross-build.patch
@@ -0,0 +1,169 @@
+# We need to ensure our host tools get run during build, not the freshly
+# built cross-tools (this will not work), so we introduce HOSTPYTHON and HOSTPGEN.
+# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>
+
+Index: Python-2.7.1/setup.py
+===================================================================
+--- Python-2.7.1.orig/setup.py 2010-12-27 13:16:38.032631011 -0500
++++ Python-2.7.1/setup.py 2010-12-27 13:16:50.130290766 -0500
+@@ -313,6 +313,7 @@
+ self.failed.append(ext.name)
+ self.announce('*** WARNING: renaming "%s" since importing it'
+ ' failed: %s' % (ext.name, why), level=3)
++ return
+ assert not self.inplace
+ basename, tail = os.path.splitext(ext_filename)
+ newname = basename + "_failed" + tail
+@@ -347,8 +348,8 @@
+
+ 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.include_dirs, '/usr/local/include')
++ # add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
++ # add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+
+ # Add paths specified in the environment variables LDFLAGS and
+ # CPPFLAGS for header and library files.
+@@ -452,6 +453,9 @@
+
+ # XXX Omitted modules: gl, pure, dl, SGI-specific modules
+
++ lib_dirs = [ os.getenv( "STAGING_LIBDIR" ) ]
++ inc_dirs = [ os.getenv( "STAGING_INCDIR" ) ]
++
+ #
+ # The following modules are all pretty straightforward, and compile
+ # on pretty much any POSIXish platform.
+Index: Python-2.7.1/Makefile.pre.in
+===================================================================
+--- Python-2.7.1.orig/Makefile.pre.in 2010-12-27 13:16:38.022628181 -0500
++++ Python-2.7.1/Makefile.pre.in 2010-12-27 13:17:31.870473931 -0500
+@@ -201,6 +201,7 @@
+
+ ##########################################################################
+ # Grammar
++GRAMMAR_STAMP= $(srcdir)/grammar-stamp
+ GRAMMAR_H= $(srcdir)/Include/graminit.h
+ GRAMMAR_C= $(srcdir)/Python/graminit.c
+ GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
+@@ -380,7 +381,7 @@
+ $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
+
+ run_profile_task:
+- ./$(BUILDPYTHON) $(PROFILE_TASK)
++ $(HOSTPYTHON) $(PROFILE_TASK)
+
+ build_all_use_profile:
+ $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
+@@ -398,14 +399,14 @@
+ $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+
+ platform: $(BUILDPYTHON)
+- $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
++ $(RUNSHARED) $(HOSTPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
+
+
+ # Build the shared modules
+ sharedmods: $(BUILDPYTHON)
+ @case $$MAKEFLAGS in \
+- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
+- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
++ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
++ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
+ esac
+
+ # Build static library
+@@ -535,10 +536,24 @@
+ Modules/python.o: $(srcdir)/Modules/python.c
+ $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
+
++# GNU "make" interprets rules with two dependents as two copies of the rule.
++#
++# In a parallel build this can lead to pgen being run twice, once for each of
++# GRAMMAR_H and GRAMMAR_C, leading to race conditions in which the compiler
++# reads a partially-overwritten copy of one of these files, leading to syntax
++# errors (or linker errors if the fragment happens to be syntactically valid C)
++#
++# See http://www.gnu.org/software/hello/manual/automake/Multiple-Outputs.html
++# for more information.
++#
++# Introduce ".grammar-stamp" as a contrived single output from PGEN to avoid
++# this:
++$(GRAMMAR_H) $(GRAMMAR_C): $(GRAMMAR_STAMP)
+
+-$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
++$(GRAMMAR_STAMP): $(PGEN) $(GRAMMAR_INPUT)
+ -@$(INSTALL) -d Include
+ -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
++ touch $(GRAMMAR_STAMP)
+
+ $(PGEN): $(PGENOBJS)
+ $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
+@@ -921,25 +936,25 @@
+ done
+ $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
+ PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
++ $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
+ -d $(LIBDEST) -f \
+ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+ $(DESTDIR)$(LIBDEST)
+ PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
++ $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ -d $(LIBDEST) -f \
+ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+ $(DESTDIR)$(LIBDEST)
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
++ $(HOSTPYTHON) -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 \
++ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
+ -d $(LIBDEST)/site-packages -f \
+ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
++ $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
+
+ # Create the PLATDIR source directory, if one wasn't distributed..
+ $(srcdir)/Lib/$(PLATDIR):
+@@ -1044,7 +1059,7 @@
+ # Install the dynamically loadable modules
+ # This goes into $(exec_prefix)
+ sharedinstall: sharedmods
+- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
++ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
+ --prefix=$(prefix) \
+ --install-scripts=$(BINDIR) \
+ --install-platlib=$(DESTSHARED) \
+@@ -1117,7 +1132,7 @@
+ # This installs a few of the useful scripts in Tools/scripts
+ scriptsinstall:
+ SRCDIR=$(srcdir) $(RUNSHARED) \
+- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
++ $(HOSTPYTHON) $(srcdir)/Tools/scripts/setup.py install \
+ --prefix=$(prefix) \
+ --install-scripts=$(BINDIR) \
+ --root=/$(DESTDIR)
+@@ -1139,7 +1154,7 @@
+
+ # Run reindent on the library
+ reindent:
+- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
++ $(HOSTPYTHON) $(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
+@@ -1242,7 +1257,7 @@
+
+ # Perform some verification checks on any modified files.
+ patchcheck:
+- $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
++ $(RUNSHARED) $(HOSTPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
+
+ # Dependencies
+
diff --git a/recipes/python/python-2.7.1/02-remove-test-for-cross.patch b/recipes/python/python-2.7.1/02-remove-test-for-cross.patch
new file mode 100644
index 0000000000..ab5858c1bf
--- /dev/null
+++ b/recipes/python/python-2.7.1/02-remove-test-for-cross.patch
@@ -0,0 +1,108 @@
+# OpenEmbedded prepopulates the autotools site cache, so if this
+# would be using AC_TRY_CACHE, we could patch it in a more sane way
+# Alas, I don't have enough autotalent to do that.
+#
+# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>
+Index: Python-2.7.1/configure.in
+===================================================================
+--- Python-2.7.1.orig/configure.in 2010-12-26 10:02:03.222663593 -0500
++++ Python-2.7.1/configure.in 2010-12-26 10:02:19.891414484 -0500
+@@ -2822,49 +2822,6 @@
+ AC_CHECK_LIB(resolv, inet_aton)
+ )
+
+-# On Tru64, chflags seems to be present, but calling it will
+-# exit Python
+-AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[[
+-#include <sys/stat.h>
+-#include <unistd.h>
+-int main(int argc, char*argv[])
+-{
+- if(chflags(argv[0], 0) != 0)
+- return 1;
+- return 0;
+-}
+-]]])],
+-[ac_cv_have_chflags=yes],
+-[ac_cv_have_chflags=no],
+-[ac_cv_have_chflags=cross])
+-])
+-if test "$ac_cv_have_chflags" = cross ; then
+- AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
+-fi
+-if test "$ac_cv_have_chflags" = yes ; then
+- AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the `chflags' function.])
+-fi
+-
+-AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[[
+-#include <sys/stat.h>
+-#include <unistd.h>
+-int main(int argc, char*argv[])
+-{
+- if(lchflags(argv[0], 0) != 0)
+- return 1;
+- return 0;
+-}
+-]]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross])
+-])
+-if test "$ac_cv_have_lchflags" = cross ; then
+- AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
+-fi
+-if test "$ac_cv_have_lchflags" = yes ; then
+- AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the `lchflags' function.])
+-fi
+-
+ dnl Check if system zlib has *Copy() functions
+ dnl
+ dnl On MacOSX the linker will search for dylibs on the entire linker path
+@@ -4210,48 +4167,6 @@
+ LIBS="$LIBS -framework CoreFoundation"
+ fi
+
+-
+-AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <stdio.h>
+-#include <stddef.h>
+-#include <string.h>
+-
+-#ifdef HAVE_SYS_TYPES_H
+-#include <sys/types.h>
+-#endif
+-
+-#ifdef HAVE_SSIZE_T
+-typedef ssize_t Py_ssize_t;
+-#elif SIZEOF_VOID_P == SIZEOF_LONG
+-typedef long Py_ssize_t;
+-#else
+-typedef int Py_ssize_t;
+-#endif
+-
+-int main()
+-{
+- char buffer[256];
+-
+- if(sprintf(buffer, "%zd", (size_t)123) < 0)
+- return 1;
+-
+- if (strcmp(buffer, "123"))
+- return 1;
+-
+- if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
+- return 1;
+-
+- if (strcmp(buffer, "-123"))
+- return 1;
+-
+- return 0;
+-}
+-]])],
+-[ac_cv_have_size_t_format=yes],
+-[ac_cv_have_size_t_format=no],
+-[ac_cv_have_size_t_format="cross -- assuming yes"
+-])])
+ if test "$ac_cv_have_size_t_format" != no ; then
+ AC_DEFINE(PY_FORMAT_SIZE_T, "z",
+ [Define to printf format modifier for Py_ssize_t])
diff --git a/recipes/python/python-2.7.1/03-fix-tkinter-detection.patch b/recipes/python/python-2.7.1/03-fix-tkinter-detection.patch
new file mode 100644
index 0000000000..47274b3f9b
--- /dev/null
+++ b/recipes/python/python-2.7.1/03-fix-tkinter-detection.patch
@@ -0,0 +1,40 @@
+# We need to supply STAGING_INCDIR here, otherwise the Tk headers
+# will not be found.
+# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille.de>
+
+Index: Python-2.7.1/setup.py
+===================================================================
+--- Python-2.7.1.orig/setup.py 2010-12-26 10:01:38.992621096 -0500
++++ Python-2.7.1/setup.py 2010-12-26 10:02:31.032604626 -0500
+@@ -1712,7 +1712,7 @@
+ dotversion = dotversion[:-1] + '.' + dotversion[-1]
+ tcl_include_sub = []
+ tk_include_sub = []
+- for dir in inc_dirs:
++ for dir in [os.getenv("STAGING_INCDIR")]:
+ tcl_include_sub += [dir + os.sep + "tcl" + dotversion]
+ tk_include_sub += [dir + os.sep + "tk" + dotversion]
+ tk_include_sub += tcl_include_sub
+@@ -1731,22 +1731,6 @@
+ if dir not in include_dirs:
+ include_dirs.append(dir)
+
+- # Check for various platform-specific directories
+- if platform == 'sunos5':
+- include_dirs.append('/usr/openwin/include')
+- added_lib_dirs.append('/usr/openwin/lib')
+- elif os.path.exists('/usr/X11R6/include'):
+- include_dirs.append('/usr/X11R6/include')
+- added_lib_dirs.append('/usr/X11R6/lib64')
+- added_lib_dirs.append('/usr/X11R6/lib')
+- elif os.path.exists('/usr/X11R5/include'):
+- include_dirs.append('/usr/X11R5/include')
+- added_lib_dirs.append('/usr/X11R5/lib')
+- else:
+- # Assume default location for X11
+- include_dirs.append('/usr/X11/include')
+- added_lib_dirs.append('/usr/X11/lib')
+-
+ # If Cygwin, then verify that X is installed before proceeding
+ if platform == 'cygwin':
+ x11_inc = find_file('X11/Xlib.h', [], include_dirs)
diff --git a/recipes/python/python-2.7.1/04-default-is-optimized.patch b/recipes/python/python-2.7.1/04-default-is-optimized.patch
new file mode 100644
index 0000000000..5131e0ba69
--- /dev/null
+++ b/recipes/python/python-2.7.1/04-default-is-optimized.patch
@@ -0,0 +1,18 @@
+# When compiling for an embedded system, we need every bit of
+# performance we can get. default to optimized with the option
+# of opt-out.
+# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>
+
+Index: Python-2.6.1/Python/compile.c
+===================================================================
+--- Python-2.6.1.orig/Python/compile.c
++++ Python-2.6.1/Python/compile.c
+@@ -32,7 +32,7 @@
+ #include "symtable.h"
+ #include "opcode.h"
+
+-int Py_OptimizeFlag = 0;
++int Py_OptimizeFlag = 1;
+
+ #define DEFAULT_BLOCK_SIZE 16
+ #define DEFAULT_BLOCKS 8
diff --git a/recipes/python/python-2.7.1/05-enable-ctypes-cross-build.patch b/recipes/python/python-2.7.1/05-enable-ctypes-cross-build.patch
new file mode 100644
index 0000000000..c33dc9fbf2
--- /dev/null
+++ b/recipes/python/python-2.7.1/05-enable-ctypes-cross-build.patch
@@ -0,0 +1,28 @@
+# CTypes need to know the actual host we are building on.
+# Signed-Off: Michael Dietrich <mdt@emdete.de>
+
+Index: Python-2.7.1/setup.py
+===================================================================
+--- Python-2.7.1.orig/setup.py 2010-12-26 10:02:31.032604626 -0500
++++ Python-2.7.1/setup.py 2010-12-26 10:02:43.182604395 -0500
+@@ -1825,16 +1825,16 @@
+ ffi_configfile):
+ from distutils.dir_util import mkpath
+ mkpath(ffi_builddir)
+- config_args = []
++ config_args = ['--host=%s' % os.environ["HOST_SYS"], ]
+
+ # Pass empty CFLAGS because we'll just append the resulting
+ # CFLAGS to Python's; -g or -O2 is to be avoided.
+- cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
+- % (ffi_builddir, ffi_srcdir, " ".join(config_args))
++ cmd = "(cd %s && autoconf -W cross) && (cd %s && env CFLAGS='' '%s/configure' %s)" \
++ % (ffi_srcdir, ffi_builddir, ffi_srcdir, " ".join(config_args))
+
+ res = os.system(cmd)
+ if res or not os.path.exists(ffi_configfile):
+- print "Failed to configure _ctypes module"
++ print "Failed to configure _ctypes module (res=%d) or missing conffile=%s" % ( res, ffi_configfile )
+ return False
+
+ fficonfig = {}
diff --git a/recipes/python/python-2.7.1/06-ctypes-libffi-fix-configure.patch b/recipes/python/python-2.7.1/06-ctypes-libffi-fix-configure.patch
new file mode 100644
index 0000000000..b5e59e6eb8
--- /dev/null
+++ b/recipes/python/python-2.7.1/06-ctypes-libffi-fix-configure.patch
@@ -0,0 +1,44 @@
+This fixes configure issues with recent autoconf, e.g:
+ autoreconf: Entering directory `Modules/_ctypes/libffi'
+ autoreconf: configure.ac: not using Gettext
+ autoreconf: running: aclocal --force
+ configure.ac:26: error: m4_copy: won't overwrite defined macro: _AC_ARG_VAR_PRECIOUS
+ configure.ac:26: the top level
+
+The problem is still present in python-2.6.5 but fixed in python-svn.
+
+Index: Python-2.7.1/Modules/_ctypes/libffi/Makefile.am
+===================================================================
+--- Python-2.7.1.orig/Modules/_ctypes/libffi/Makefile.am 2010-03-19 14:59:20.000000000 -0400
++++ Python-2.7.1/Modules/_ctypes/libffi/Makefile.am 2010-12-26 10:05:56.112625174 -0500
+@@ -2,7 +2,7 @@
+
+ AUTOMAKE_OPTIONS = foreign subdir-objects
+
+-SUBDIRS = include testsuite man
++SUBDIRS = include
+
+ EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \
+ src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \
+@@ -34,8 +34,6 @@
+ libtool-version ChangeLog.libffi m4/libtool.m4 \
+ m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4
+
+-info_TEXINFOS = doc/libffi.texi
+-
+ ## ################################################################
+
+ ##
+Index: Python-2.7.1/Modules/_ctypes/libffi/configure.ac
+===================================================================
+--- Python-2.7.1.orig/Modules/_ctypes/libffi/configure.ac 2010-12-26 10:06:09.752605599 -0500
++++ Python-2.7.1/Modules/_ctypes/libffi/configure.ac 2010-12-26 10:07:18.260769612 -0500
+@@ -409,7 +409,7 @@
+
+ AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
+
+-AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc)
++AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc Makefile)
+
+ AC_CONFIG_LINKS(include/ffi_common.h:include/ffi_common.h)
+
diff --git a/recipes/python/python-2.7.1/10-distutils-fix-swig-parameter.patch b/recipes/python/python-2.7.1/10-distutils-fix-swig-parameter.patch
new file mode 100644
index 0000000000..0e8695467b
--- /dev/null
+++ b/recipes/python/python-2.7.1/10-distutils-fix-swig-parameter.patch
@@ -0,0 +1,16 @@
+# Some versions of SWIG do not use the extension parameter.
+# Make it optional.
+# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>
+Index: Python-2.7.1/Lib/distutils/command/build_ext.py
+===================================================================
+--- Python-2.7.1.orig/Lib/distutils/command/build_ext.py 2010-09-10 16:03:17.000000000 -0400
++++ Python-2.7.1/Lib/distutils/command/build_ext.py 2010-12-26 10:07:28.492632349 -0500
+@@ -531,7 +531,7 @@
+ target_lang=language)
+
+
+- def swig_sources (self, sources, extension):
++ def swig_sources (self, sources, extension=None):
+
+ """Walk the list of source files in 'sources', looking for SWIG
+ interface (.i) files. Run SWIG on all that are found, and
diff --git a/recipes/python/python-2.7.1/11-distutils-never-modify-shebang-line.patch b/recipes/python/python-2.7.1/11-distutils-never-modify-shebang-line.patch
new file mode 100644
index 0000000000..20f36059a8
--- /dev/null
+++ b/recipes/python/python-2.7.1/11-distutils-never-modify-shebang-line.patch
@@ -0,0 +1,18 @@
+# Don't modify the she-bang line for a cross-build.
+# Otherwise it points to our hostpython (which we do not want)
+#
+# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>
+
+Index: Python-2.7.1/Lib/distutils/command/build_scripts.py
+===================================================================
+--- Python-2.7.1.orig/Lib/distutils/command/build_scripts.py 2010-01-23 04:23:15.000000000 -0500
++++ Python-2.7.1/Lib/distutils/command/build_scripts.py 2010-12-26 10:07:35.762597668 -0500
+@@ -85,7 +85,7 @@
+ continue
+
+ match = first_line_re.match(first_line)
+- if match:
++ if False: #match:
+ adjust = 1
+ post_interp = match.group(1) or ''
+
diff --git a/recipes/python/python-2.7.1/12-distutils-prefix-is-inside-staging-area.patch b/recipes/python/python-2.7.1/12-distutils-prefix-is-inside-staging-area.patch
new file mode 100644
index 0000000000..afe420106d
--- /dev/null
+++ b/recipes/python/python-2.7.1/12-distutils-prefix-is-inside-staging-area.patch
@@ -0,0 +1,60 @@
+# The proper prefix is inside our staging area.
+# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>
+
+Index: Python-2.7.1/Lib/distutils/sysconfig.py
+===================================================================
+--- Python-2.7.1.orig/Lib/distutils/sysconfig.py 2010-11-06 10:16:30.000000000 -0400
++++ Python-2.7.1/Lib/distutils/sysconfig.py 2010-12-26 10:08:40.760410838 -0500
+@@ -19,8 +19,8 @@
+ from distutils.errors import DistutilsPlatformError
+
+ # These are needed in a couple of spots, so just compute them once.
+-PREFIX = os.path.normpath(sys.prefix)
+-EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
++PREFIX = os.path.normpath(sys.prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
++EXEC_PREFIX = os.path.normpath(sys.exec_prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
+
+ # Path to the base directory of the project. On Windows the binary may
+ # live in project/PCBuild9. If we're dealing with an x64 Windows build,
+@@ -70,7 +70,10 @@
+ sys.exec_prefix -- i.e., ignore 'plat_specific'.
+ """
+ if prefix is None:
+- prefix = plat_specific and EXEC_PREFIX or PREFIX
++ if plat_specific:
++ prefix = plat_specific and os.environ['STAGING_INCDIR'].rstrip('include')
++ else:
++ prefix = plat_specific and EXEC_PREFIX or PREFIX
+
+ if os.name == "posix":
+ if python_build:
+@@ -111,7 +114,10 @@
+ sys.exec_prefix -- i.e., ignore 'plat_specific'.
+ """
+ if prefix is None:
+- prefix = plat_specific and EXEC_PREFIX or PREFIX
++ if plat_specific:
++ prefix = plat_specific and os.environ['STAGING_LIBDIR'].rstrip('lib')
++ else:
++ prefix = plat_specific and EXEC_PREFIX or PREFIX
+
+ if os.name == "posix":
+ libpython = os.path.join(prefix,
+@@ -199,7 +205,7 @@
+ else:
+ # The name of the config.h file changed in 2.2
+ config_h = 'pyconfig.h'
+- return os.path.join(inc_dir, config_h)
++ return os.path.join(inc_dir, config_h).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
+
+
+ def get_makefile_filename():
+@@ -207,7 +213,7 @@
+ if python_build:
+ return os.path.join(os.path.dirname(sys.executable), "Makefile")
+ lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
+- return os.path.join(lib_dir, "config", "Makefile")
++ return os.path.join(lib_dir, "config", "Makefile").replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
+
+
+ def parse_config_h(fp, g=None):
diff --git a/recipes/python/python-2.7.1/99-ignore-optimization-flag.patch b/recipes/python/python-2.7.1/99-ignore-optimization-flag.patch
new file mode 100644
index 0000000000..f068ecedaf
--- /dev/null
+++ b/recipes/python/python-2.7.1/99-ignore-optimization-flag.patch
@@ -0,0 +1,19 @@
+# Reinstate the empty -O option to fix weird mixing of native and target
+# binaries and libraries with LD_LIBRARY_PATH when host==target
+#
+# Signed-off-by: Denys Dmytriyenko <denis@denix.org>
+
+Index: Python-2.7.1/Modules/main.c
+===================================================================
+--- Python-2.7.1.orig/Modules/main.c 2010-06-13 02:50:39.000000000 -0400
++++ Python-2.7.1/Modules/main.c 2010-12-26 10:09:34.300455892 -0500
+@@ -329,8 +329,7 @@
+
+ /* case 'J': reserved for Jython */
+
+- case 'O':
+- Py_OptimizeFlag++;
++ case 'O': /* ignore it */
+ break;
+
+ case 'B':
diff --git a/recipes/python/python-2.7.1/debug.patch b/recipes/python/python-2.7.1/debug.patch
new file mode 100644
index 0000000000..c7f5081b35
--- /dev/null
+++ b/recipes/python/python-2.7.1/debug.patch
@@ -0,0 +1,27 @@
+Index: Python-2.7.1/Lib/distutils/unixccompiler.py
+===================================================================
+--- Python-2.7.1.orig/Lib/distutils/unixccompiler.py 2010-06-27 08:36:16.000000000 -0400
++++ Python-2.7.1/Lib/distutils/unixccompiler.py 2010-12-26 10:09:44.282632589 -0500
+@@ -318,6 +318,8 @@
+
+
+
++ print "Looking in %s for %s" % (lib, dirs)
++
+ for dir in dirs:
+ shared = os.path.join(dir, shared_f)
+ dylib = os.path.join(dir, dylib_f)
+@@ -336,10 +338,13 @@
+ # assuming that *all* Unix C compilers do. And of course I'm
+ # ignoring even GCC's "-static" option. So sue me.
+ if os.path.exists(dylib):
++ print "Found %s" % (dylib)
+ return dylib
+ elif os.path.exists(shared):
++ print "Found %s" % (shared)
+ return shared
+ elif os.path.exists(static):
++ print "Found %s" % (static)
+ return static
+
+ # Oops, didn't find it in *any* of 'dirs'
diff --git a/recipes/python/python-2.7.1/nohostlibs.patch b/recipes/python/python-2.7.1/nohostlibs.patch
new file mode 100644
index 0000000000..6f33a49437
--- /dev/null
+++ b/recipes/python/python-2.7.1/nohostlibs.patch
@@ -0,0 +1,29 @@
+Index: Python-2.7.1/setup.py
+===================================================================
+--- Python-2.7.1.orig/setup.py 2010-12-26 10:02:43.000000000 -0500
++++ Python-2.7.1/setup.py 2010-12-26 10:12:30.920427195 -0500
+@@ -404,11 +404,8 @@
+ # 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 = self.compiler.library_dirs
++ inc_dirs = self.compiler.include_dirs
+ exts = []
+ missing = []
+
+@@ -657,9 +654,7 @@
+ pass # Issue 7384: Already linked against curses or tinfo.
+ elif curses_library:
+ readline_libs.append(curses_library)
+- elif self.compiler.find_library_file(lib_dirs +
+- ['/usr/lib/termcap'],
+- 'termcap'):
++ elif self.compiler.find_library_file(lib_dirs, 'termcap'):
+ readline_libs.append('termcap')
+ exts.append( Extension('readline', ['readline.c'],
+ library_dirs=['/usr/lib/termcap'],
diff --git a/recipes/python/python-2.7.1/sitecustomize.py b/recipes/python/python-2.7.1/sitecustomize.py
new file mode 100644
index 0000000000..273901898a
--- /dev/null
+++ b/recipes/python/python-2.7.1/sitecustomize.py
@@ -0,0 +1,45 @@
+# OpenEmbedded sitecustomize.py (C) 2002-2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
+# GPLv2 or later
+# Version: 20081123
+# Features:
+# * set proper default encoding
+# * enable readline completion in the interactive interpreter
+# * load command line history on startup
+# * save command line history on exit
+
+import os
+
+def __exithandler():
+ try:
+ readline.write_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) )
+ except IOError:
+ pass
+
+def __registerExitHandler():
+ import atexit
+ atexit.register( __exithandler )
+
+def __enableReadlineSupport():
+ readline.set_history_length( 1000 )
+ readline.parse_and_bind( "tab: complete" )
+ try:
+ readline.read_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) )
+ except IOError:
+ pass
+
+def __enableDefaultEncoding():
+ import sys
+ try:
+ sys.setdefaultencoding( "utf8" )
+ except LookupError:
+ pass
+
+import sys
+try:
+ import rlcompleter, readline
+except ImportError:
+ pass
+else:
+ __enableDefaultEncoding()
+ __registerExitHandler()
+ __enableReadlineSupport()