From bea64f3bd904ddc02694e07551cb631ac55f4e23 Mon Sep 17 00:00:00 2001 From: Michael 'Mickey' Lauer Date: Wed, 10 Dec 2008 00:18:17 +0100 Subject: Python 2.6: here we are. WIP :) --- .../00-fix-bindir-libdir-for-cross.patch | 20 ++++++++ .../04-default-is-optimized.patch | 18 +++++++ .../10-distutils-fix-swig-parameter.patch | 16 ++++++ .../11-distutils-never-modify-shebang-line.patch | 18 +++++++ ...2-distutils-prefix-is-inside-staging-area.patch | 60 ++++++++++++++++++++++ .../python/python-native-2.6.1/sitecustomize.py | 45 ++++++++++++++++ 6 files changed, 177 insertions(+) create mode 100644 packages/python/python-native-2.6.1/00-fix-bindir-libdir-for-cross.patch create mode 100644 packages/python/python-native-2.6.1/04-default-is-optimized.patch create mode 100644 packages/python/python-native-2.6.1/10-distutils-fix-swig-parameter.patch create mode 100644 packages/python/python-native-2.6.1/11-distutils-never-modify-shebang-line.patch create mode 100644 packages/python/python-native-2.6.1/12-distutils-prefix-is-inside-staging-area.patch create mode 100644 packages/python/python-native-2.6.1/sitecustomize.py (limited to 'packages/python/python-native-2.6.1') diff --git a/packages/python/python-native-2.6.1/00-fix-bindir-libdir-for-cross.patch b/packages/python/python-native-2.6.1/00-fix-bindir-libdir-for-cross.patch new file mode 100644 index 0000000000..2559e3a0e4 --- /dev/null +++ b/packages/python/python-native-2.6.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 + +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/packages/python/python-native-2.6.1/04-default-is-optimized.patch b/packages/python/python-native-2.6.1/04-default-is-optimized.patch new file mode 100644 index 0000000000..5131e0ba69 --- /dev/null +++ b/packages/python/python-native-2.6.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 + +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/packages/python/python-native-2.6.1/10-distutils-fix-swig-parameter.patch b/packages/python/python-native-2.6.1/10-distutils-fix-swig-parameter.patch new file mode 100644 index 0000000000..f5e852a118 --- /dev/null +++ b/packages/python/python-native-2.6.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 +Index: Python-2.6.1/Lib/distutils/command/build_ext.py +=================================================================== +--- Python-2.6.1.orig/Lib/distutils/command/build_ext.py ++++ Python-2.6.1/Lib/distutils/command/build_ext.py +@@ -566,7 +566,7 @@ class build_ext (Command): + 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/packages/python/python-native-2.6.1/11-distutils-never-modify-shebang-line.patch b/packages/python/python-native-2.6.1/11-distutils-never-modify-shebang-line.patch new file mode 100644 index 0000000000..8354e266fa --- /dev/null +++ b/packages/python/python-native-2.6.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 + +Index: Python-2.6.1/Lib/distutils/command/build_scripts.py +=================================================================== +--- Python-2.6.1.orig/Lib/distutils/command/build_scripts.py ++++ Python-2.6.1/Lib/distutils/command/build_scripts.py +@@ -87,7 +87,7 @@ class build_scripts (Command): + continue + + match = first_line_re.match(first_line) +- if match: ++ if False: #match: + adjust = 1 + post_interp = match.group(1) or '' + diff --git a/packages/python/python-native-2.6.1/12-distutils-prefix-is-inside-staging-area.patch b/packages/python/python-native-2.6.1/12-distutils-prefix-is-inside-staging-area.patch new file mode 100644 index 0000000000..aa4393679f --- /dev/null +++ b/packages/python/python-native-2.6.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 + +Index: Python-2.6.1/Lib/distutils/sysconfig.py +=================================================================== +--- Python-2.6.1.orig/Lib/distutils/sysconfig.py ++++ Python-2.6.1/Lib/distutils/sysconfig.py +@@ -19,8 +19,8 @@ import sys + 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 @@ def get_python_inc(plat_specific=0, pref + 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: + base = os.path.dirname(os.path.abspath(sys.executable)) +@@ -112,7 +115,10 @@ def get_python_lib(plat_specific=0, stan + 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, +@@ -218,7 +218,7 @@ def get_config_h_filename(): + 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(): +@@ -226,7 +226,7 @@ def get_makefile_filename(): + 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/packages/python/python-native-2.6.1/sitecustomize.py b/packages/python/python-native-2.6.1/sitecustomize.py new file mode 100644 index 0000000000..273901898a --- /dev/null +++ b/packages/python/python-native-2.6.1/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