From ba1c4fa94426f8e46bf0e9ab1d225039bdb78158 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 3 Dec 2009 12:08:52 +0000 Subject: python: Update 2.5 -> 2.6 (from OE.dev) Signed-off-by: Richard Purdie --- .../00-fix-bindir-libdir-for-cross.patch | 20 ++++ .../01-use-proper-tools-for-cross-build.patch | 116 +++++++++++++++++++++ .../python-2.6.2/02-remove-test-for-cross.patch | 94 +++++++++++++++++ .../python-2.6.2/03-fix-tkinter-detection.patch | 40 +++++++ .../python-2.6.2/04-default-is-optimized.patch | 52 +++++++++ .../05-enable-ctypes-cross-build.patch | 28 +++++ .../python-2.6.2/99-ignore-optimization-flag.patch | 19 ++++ meta/packages/python/python-2.6.2/sitecustomize.py | 45 ++++++++ 8 files changed, 414 insertions(+) create mode 100644 meta/packages/python/python-2.6.2/00-fix-bindir-libdir-for-cross.patch create mode 100644 meta/packages/python/python-2.6.2/01-use-proper-tools-for-cross-build.patch create mode 100644 meta/packages/python/python-2.6.2/02-remove-test-for-cross.patch create mode 100644 meta/packages/python/python-2.6.2/03-fix-tkinter-detection.patch create mode 100644 meta/packages/python/python-2.6.2/04-default-is-optimized.patch create mode 100644 meta/packages/python/python-2.6.2/05-enable-ctypes-cross-build.patch create mode 100644 meta/packages/python/python-2.6.2/99-ignore-optimization-flag.patch create mode 100644 meta/packages/python/python-2.6.2/sitecustomize.py (limited to 'meta/packages/python/python-2.6.2') diff --git a/meta/packages/python/python-2.6.2/00-fix-bindir-libdir-for-cross.patch b/meta/packages/python/python-2.6.2/00-fix-bindir-libdir-for-cross.patch new file mode 100644 index 0000000000..2559e3a0e4 --- /dev/null +++ b/meta/packages/python/python-2.6.2/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 + +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/meta/packages/python/python-2.6.2/01-use-proper-tools-for-cross-build.patch b/meta/packages/python/python-2.6.2/01-use-proper-tools-for-cross-build.patch new file mode 100644 index 0000000000..e89faa4fb0 --- /dev/null +++ b/meta/packages/python/python-2.6.2/01-use-proper-tools-for-cross-build.patch @@ -0,0 +1,116 @@ +# 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 + +Index: Python-2.6.1/Makefile.pre.in +=================================================================== +--- Python-2.6.1.orig/Makefile.pre.in ++++ Python-2.6.1/Makefile.pre.in +@@ -175,6 +175,7 @@ UNICODE_OBJS= @UNICODE_OBJS@ + + PYTHON= python$(EXE) + BUILDPYTHON= python$(BUILDEXE) ++HOSTPYTHON= $(BUILDPYTHON) + + # The task to run while instrument when building the profile-opt target + PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck +@@ -205,7 +206,7 @@ GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar + ########################################################################## + # Parser + PGEN= Parser/pgen$(EXE) +- ++HOSTPGEN= $(PGEN)$(EXE) + POBJS= \ + Parser/acceler.o \ + Parser/grammar1.o \ +@@ -394,8 +395,8 @@ platform: $(BUILDPYTHON) + # 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 +@@ -513,7 +514,7 @@ Modules/python.o: $(srcdir)/Modules/pyth + + $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) + -@$(INSTALL) -d Include +- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) ++ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) + + $(PGEN): $(PGENOBJS) + $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) +@@ -879,23 +880,23 @@ libinstall: build_all $(srcdir)/Lib/$(PL + 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' $(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' $(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): +@@ -993,7 +994,7 @@ libainstall: all + # Install the dynamically loadable modules + # This goes into $(exec_prefix) + sharedinstall: +- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ ++ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \ + --prefix=$(prefix) \ + --install-scripts=$(BINDIR) \ + --install-platlib=$(DESTSHARED) \ +Index: Python-2.6.1/setup.py +=================================================================== +--- Python-2.6.1.orig/setup.py ++++ Python-2.6.1/setup.py +@@ -276,6 +276,7 @@ class PyBuildExt(build_ext): + 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 +@@ -310,8 +311,8 @@ class PyBuildExt(build_ext): + + 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. +@@ -410,6 +411,9 @@ class PyBuildExt(build_ext): + + # 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. diff --git a/meta/packages/python/python-2.6.2/02-remove-test-for-cross.patch b/meta/packages/python/python-2.6.2/02-remove-test-for-cross.patch new file mode 100644 index 0000000000..48386ea462 --- /dev/null +++ b/meta/packages/python/python-2.6.2/02-remove-test-for-cross.patch @@ -0,0 +1,94 @@ +# 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 +Index: Python-2.6.1/configure.in +=================================================================== +--- Python-2.6.1.orig/configure.in ++++ Python-2.6.1/configure.in +@@ -2556,38 +2556,6 @@ AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_ + AC_CHECK_LIB(resolv, inet_aton) + ) + +-# On Tru64, chflags seems to be present, but calling it will +-# exit Python +-AC_MSG_CHECKING(for chflags) +-AC_TRY_RUN([ +-#include +-#include +-int main(int argc, char*argv[]) +-{ +- if(chflags(argv[0], 0) != 0) +- return 1; +- return 0; +-} +-],AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.) +- AC_MSG_RESULT(yes), +- AC_MSG_RESULT(no) +-) +- +-AC_MSG_CHECKING(for lchflags) +-AC_TRY_RUN([ +-#include +-#include +-int main(int argc, char*argv[]) +-{ +- if(lchflags(argv[0], 0) != 0) +- return 1; +- return 0; +-} +-],AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.) +- AC_MSG_RESULT(yes), +- AC_MSG_RESULT(no) +-) +- + dnl Check if system zlib has *Copy() functions + dnl + dnl On MacOSX the linker will search for dylibs on the entire linker path +@@ -3649,45 +3617,6 @@ else + AC_MSG_RESULT(no) + fi + +-AC_MSG_CHECKING(for %zd printf() format support) +-AC_TRY_RUN([#include +-#include +-#include +- +-#ifdef HAVE_SYS_TYPES_H +-#include +-#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_MSG_RESULT(yes) +- AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])], +- AC_MSG_RESULT(no)) +- + AC_CHECK_TYPE(socklen_t,, + AC_DEFINE(socklen_t,int, + Define to `int' if does not define.),[ diff --git a/meta/packages/python/python-2.6.2/03-fix-tkinter-detection.patch b/meta/packages/python/python-2.6.2/03-fix-tkinter-detection.patch new file mode 100644 index 0000000000..a1a385a07c --- /dev/null +++ b/meta/packages/python/python-2.6.2/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 + +Index: Python-2.6.1/setup.py +=================================================================== +--- Python-2.6.1.orig/setup.py ++++ Python-2.6.1/setup.py +@@ -1543,7 +1543,7 @@ class PyBuildExt(build_ext): + 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 +@@ -1562,22 +1562,6 @@ class PyBuildExt(build_ext): + 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/meta/packages/python/python-2.6.2/04-default-is-optimized.patch b/meta/packages/python/python-2.6.2/04-default-is-optimized.patch new file mode 100644 index 0000000000..805f4f696c --- /dev/null +++ b/meta/packages/python/python-2.6.2/04-default-is-optimized.patch @@ -0,0 +1,52 @@ +# 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 + +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 +Index: Python-2.6.1/Modules/main.c +=================================================================== +--- Python-2.6.1.orig/Modules/main.c ++++ Python-2.6.1/Modules/main.c +@@ -40,7 +40,7 @@ static char **orig_argv; + static int orig_argc; + + /* command line options */ +-#define BASE_OPTS "3bBc:dEhiJm:OQ:sStuUvVW:xX?" ++#define BASE_OPTS "3bBc:dEhiJm:NOQ:sStuUvVW:xX?" + + #ifndef RISCOS + #define PROGRAM_OPTS BASE_OPTS +@@ -69,8 +69,7 @@ Options and arguments (and corresponding + static char *usage_2 = "\ + if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n\ + -m mod : run library module as a script (terminates option list)\n\ +--O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x\n\ +--OO : remove doc-strings in addition to the -O optimizations\n\ ++-N : do NOT optimize generated bytecode\n\ + -Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew\n\ + -s : don't add user site directory to sys.path; also PYTHONNOUSERSITE\n\ + -S : don't imply 'import site' on initialization\n\ +@@ -353,8 +352,8 @@ Py_Main(int argc, char **argv) + + /* case 'J': reserved for Jython */ + +- case 'O': +- Py_OptimizeFlag++; ++ case 'N': ++ Py_OptimizeFlag=0; + break; + + case 'B': diff --git a/meta/packages/python/python-2.6.2/05-enable-ctypes-cross-build.patch b/meta/packages/python/python-2.6.2/05-enable-ctypes-cross-build.patch new file mode 100644 index 0000000000..58b8078068 --- /dev/null +++ b/meta/packages/python/python-2.6.2/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 + +Index: Python-2.6.1/setup.py +=================================================================== +--- Python-2.6.1.orig/setup.py ++++ Python-2.6.1/setup.py +@@ -1656,16 +1656,16 @@ class PyBuildExt(build_ext): + 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/meta/packages/python/python-2.6.2/99-ignore-optimization-flag.patch b/meta/packages/python/python-2.6.2/99-ignore-optimization-flag.patch new file mode 100644 index 0000000000..02dc44c847 --- /dev/null +++ b/meta/packages/python/python-2.6.2/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 + +Index: Python-2.6.1/Modules/main.c +=================================================================== +--- Python-2.6.1-orig/Modules/main.c ++++ Python-2.6.1/Modules/main.c +@@ -352,6 +352,9 @@ Py_Main(int argc, char **argv) + + /* case 'J': reserved for Jython */ + ++ case 'O': /* ignore it */ ++ break; ++ + case 'N': + Py_OptimizeFlag=0; + break; diff --git a/meta/packages/python/python-2.6.2/sitecustomize.py b/meta/packages/python/python-2.6.2/sitecustomize.py new file mode 100644 index 0000000000..273901898a --- /dev/null +++ b/meta/packages/python/python-2.6.2/sitecustomize.py @@ -0,0 +1,45 @@ +# OpenEmbedded sitecustomize.py (C) 2002-2008 Michael 'Mickey' Lauer +# 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() -- cgit v1.2.3