Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/4] Move to Python 2.7
@ 2010-10-12  8:26 Maxime Ripard
  2010-10-12  8:26 ` [Buildroot] [PATCH 1/4] python: Move to version 2.7 Maxime Ripard
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Maxime Ripard @ 2010-10-12  8:26 UTC (permalink / raw)
  To: buildroot

Hi all !

This set of patches replaces the old yet brave python2.4 by the brand new
long term support python 2.7.

Note that the last patch is a workaround for a bug opened on the python's
bugtracker, so it should be removed anytime soon (even though the bug has
been opened two years ago).

The first two patches port existing patches to the new python version and
the third fix the new breakages when cross-compiling : bytecode generation
by compileall.py which requires the struct module, not compiled when we
compile the HOSTPYTHON. The removed part of the code is never executed for
now, but it could lead to a bug with future versions. The second breakage is
the long long int detection, which is required to build python, and is always
evaluated to false when cross-compiling.

[PATCH 1/4] python: Move to version 2.7
[PATCH 2/4] python: Port the existing patches to python2.7
[PATCH 3/4] python: Add needed extra patches.
[PATCH 4/4] python: Fix make install (Workaround python's bug #1669349)

____________________________________________________________________________

This  email  and any  files  transmitted  with it are  confidential  and are
intended solely  for the use of the individual  or entity to which  they are
addressed.  Access to this e-mail by anyone else is unauthorised. If you are
not the  intended recipient,  any disclosure,  copying,  distribution or any
action taken or omitted to be taken in reliance on it, is prohibited. E-mail
messages are not necessarily secure.  Archos does not accept  responsibility
for any changes made to this message after it was sent.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/4] python: Move to version 2.7
  2010-10-12  8:26 [Buildroot] [PATCH 0/4] Move to Python 2.7 Maxime Ripard
@ 2010-10-12  8:26 ` Maxime Ripard
  2010-10-12  8:26 ` [Buildroot] [PATCH 2/4] python: Port the existing patches to python2.7 Maxime Ripard
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Maxime Ripard @ 2010-10-12  8:26 UTC (permalink / raw)
  To: buildroot


Signed-off-by: Maxime Ripard <ripard@archos.com>
---
 package/python/python.mk |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/python/python.mk b/package/python/python.mk
index 8721d40..5c85c59 100644
--- a/package/python/python.mk
+++ b/package/python/python.mk
@@ -3,8 +3,8 @@
 # python
 #
 #############################################################
-PYTHON_VERSION=2.4.5
-PYTHON_VERSION_MAJOR=2.4
+PYTHON_VERSION=2.7
+PYTHON_VERSION_MAJOR=2.7
 PYTHON_SOURCE:=Python-$(PYTHON_VERSION).tar.bz2
 PYTHON_SITE:=http://python.org/ftp/python/$(PYTHON_VERSION)
 PYTHON_DIR:=$(BUILD_DIR)/Python-$(PYTHON_VERSION)
-- 
1.7.1


____________________________________________________________________________

This  email  and any  files  transmitted  with it are  confidential  and are
intended solely  for the use of the individual  or entity to which  they are
addressed.  Access to this e-mail by anyone else is unauthorised. If you are
not the  intended recipient,  any disclosure,  copying,  distribution or any
action taken or omitted to be taken in reliance on it, is prohibited. E-mail
messages are not necessarily secure.  Archos does not accept  responsibility
for any changes made to this message after it was sent.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/4] python: Port the existing patches to python2.7
  2010-10-12  8:26 [Buildroot] [PATCH 0/4] Move to Python 2.7 Maxime Ripard
  2010-10-12  8:26 ` [Buildroot] [PATCH 1/4] python: Move to version 2.7 Maxime Ripard
@ 2010-10-12  8:26 ` Maxime Ripard
  2010-10-12  8:26 ` [Buildroot] [PATCH 3/4] python: Add needed extra patches Maxime Ripard
  2010-10-12  8:26 ` [Buildroot] [PATCH 4/4] python: Fix make install (Workaround python's bug #1669349) Maxime Ripard
  3 siblings, 0 replies; 7+ messages in thread
From: Maxime Ripard @ 2010-10-12  8:26 UTC (permalink / raw)
  To: buildroot


Signed-off-by: Maxime Ripard <ripard@archos.com>
---
 package/python/python-2.4-001-cross-compile.patch  |  106 --------------------
 package/python/python-2.4-002-cross-compile.patch  |   36 -------
 .../python-2.4-010-disable_modules_and_ssl.patch   |   37 -------
 .../python-2.4-020-gentoo_py_dontcompile.patch     |   18 ----
 package/python/python-2.7-001-cross-compile.patch  |  103 +++++++++++++++++++
 package/python/python-2.7-002-cross-compile.patch  |   36 +++++++
 .../python-2.7-010-disable_modules_and_ssl.patch   |   38 +++++++
 .../python-2.7-020-gentoo_py_dontcompile.patch     |   17 +++
 8 files changed, 194 insertions(+), 197 deletions(-)
 delete mode 100644 package/python/python-2.4-001-cross-compile.patch
 delete mode 100644 package/python/python-2.4-002-cross-compile.patch
 delete mode 100644 package/python/python-2.4-010-disable_modules_and_ssl.patch
 delete mode 100644 package/python/python-2.4-020-gentoo_py_dontcompile.patch
 create mode 100644 package/python/python-2.7-001-cross-compile.patch
 create mode 100644 package/python/python-2.7-002-cross-compile.patch
 create mode 100644 package/python/python-2.7-010-disable_modules_and_ssl.patch
 create mode 100644 package/python/python-2.7-020-gentoo_py_dontcompile.patch

diff --git a/package/python/python-2.4-001-cross-compile.patch b/package/python/python-2.4-001-cross-compile.patch
deleted file mode 100644
index 96e52a6..0000000
--- a/package/python/python-2.4-001-cross-compile.patch
+++ /dev/null
@@ -1,106 +0,0 @@
-diff -rduNp Python-2.4.2.orig/Makefile.pre.in Python-2.4.2/Makefile.pre.in
---- Python-2.4.2.orig/Makefile.pre.in	2005-03-29 01:23:01.000000000 +0200
-+++ Python-2.4.2/Makefile.pre.in	2007-01-22 19:37:08.000000000 +0100
-@@ -162,6 +162,7 @@ UNICODE_OBJS=   @UNICODE_OBJS@
- 
- PYTHON=		python$(EXE)
- BUILDPYTHON=	python$(BUILDEXE)
-+HOSTPYTHON=	$(BUILDPYTHON)
- 
- # === Definitions added by makesetup ===
- 
-@@ -188,7 +189,7 @@ GRAMMAR_INPUT=	$(srcdir)/Grammar/Grammar
- ##########################################################################
- # Parser
- PGEN=		Parser/pgen$(EXE)
--
-+HOSTPGEN=	$(PGEN)$(EXE)
- POBJS=		\
- 		Parser/acceler.o \
- 		Parser/grammar1.o \
-@@ -320,8 +321,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
- 
- # buildno should really depend on something like LIBRARY_SRC
-@@ -442,7 +443,7 @@ Modules/ccpython.o: $(srcdir)/Modules/cc
- 
- 
- $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
--		-$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
-+		-$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
- 
- $(PGEN):	$(PGENOBJS)
- 		$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
-@@ -719,19 +720,19 @@ libinstall:	$(BUILDPYTHON) $(srcdir)/Lib
- 	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 '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 '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
- 
-@@ -826,7 +827,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) \
-diff -rduNp Python-2.4.2.orig/setup.py Python-2.4.2/setup.py
---- Python-2.4.2.orig/setup.py	2005-03-09 23:27:24.000000000 +0100
-+++ Python-2.4.2/setup.py	2007-01-22 19:37:08.000000000 +0100
-@@ -204,6 +204,7 @@ class PyBuildExt(build_ext):
-         try:
-             imp.load_dynamic(ext.name, ext_filename)
-         except ImportError, why:
-+            return
-             self.announce('*** WARNING: renaming "%s" since importing it'
-                           ' failed: %s' % (ext.name, why), level=3)
-             assert not self.inplace
-@@ -239,8 +240,6 @@ 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 paths to popular package managers on OS X/darwin
-         if sys.platform == "darwin":
-@@ -251,12 +250,6 @@ class PyBuildExt(build_ext):
-             add_dir_to_list(self.compiler.library_dirs, '/opt/local/lib')
-             add_dir_to_list(self.compiler.include_dirs, '/opt/local/include')
- 
--        if os.path.normpath(sys.prefix) != '/usr':
--            add_dir_to_list(self.compiler.library_dirs,
--                            sysconfig.get_config_var("LIBDIR"))
--            add_dir_to_list(self.compiler.include_dirs,
--                            sysconfig.get_config_var("INCLUDEDIR"))
--
-         try:
-             have_unicode = unicode
-         except NameError:
diff --git a/package/python/python-2.4-002-cross-compile.patch b/package/python/python-2.4-002-cross-compile.patch
deleted file mode 100644
index 207335a..0000000
--- a/package/python/python-2.4-002-cross-compile.patch
+++ /dev/null
@@ -1,36 +0,0 @@
---- Python-2.4.2-001/setup.py	2007-01-23 16:18:37.000000000 +0100
-+++ Python-2.4.2/setup.py	2007-01-23 16:26:43.000000000 +0100
-@@ -239,7 +239,18 @@
-         return sys.platform
- 
-     def detect_modules(self):
--        # Ensure that /usr/local is always used
-+        try:
-+            modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
-+        except KeyError:
-+            modules_include_dirs = ['/usr/include']
-+        try:
-+            modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split()
-+        except KeyError:
-+            modules_lib_dirs = ['/usr/lib']
-+        for dir in modules_include_dirs:
-+                add_dir_to_list(self.compiler.include_dirs, dir)
-+        for dir in modules_lib_dirs:
-+                add_dir_to_list(self.compiler.library_dirs, dir)
- 
-         # Add paths to popular package managers on OS X/darwin
-         if sys.platform == "darwin":
-@@ -258,11 +269,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 = []
- 
-         platform = self.get_platform()
diff --git a/package/python/python-2.4-010-disable_modules_and_ssl.patch b/package/python/python-2.4-010-disable_modules_and_ssl.patch
deleted file mode 100644
index a690eae..0000000
--- a/package/python/python-2.4-010-disable_modules_and_ssl.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-diff -rduNp Python-2.4.2-002/setup.py Python-2.4.2/setup.py
---- Python-2.4.2-002/setup.py	2007-01-22 19:41:47.000000000 +0100
-+++ Python-2.4.2/setup.py	2007-01-22 19:47:25.000000000 +0100
-@@ -15,7 +15,14 @@ from distutils.command.install import in
- from distutils.command.install_lib import install_lib
- 
- # This global variable is used to hold the list of modules to be disabled.
--disabled_module_list = []
-+try:
-+	disabled_module_list = os.environ["PYTHON_DISABLE_MODULES"].split()
-+except KeyError:
-+	disabled_module_list = []
-+try:
-+	disable_ssl = os.environ["PYTHON_DISABLE_SSL"]
-+except KeyError:
-+	disable_ssl = 0
- 
- def add_dir_to_list(dirlist, dir):
-     """Add the directory 'dir' to the list 'dirlist' (at the front) if
-@@ -247,6 +254,7 @@ class PyBuildExt(build_ext):
-         return sys.platform
- 
-     def detect_modules(self):
-+        global disable_ssl
-         try:
-             modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
-         except KeyError:
-@@ -468,7 +476,8 @@ class PyBuildExt(build_ext):
-                                      ] )
- 
-         if (ssl_incs is not None and
--            ssl_libs is not None):
-+            ssl_libs is not None and
-+			not disable_ssl):
-             exts.append( Extension('_ssl', ['_ssl.c'],
-                                    include_dirs = ssl_incs,
-                                    library_dirs = ssl_libs,
diff --git a/package/python/python-2.4-020-gentoo_py_dontcompile.patch b/package/python/python-2.4-020-gentoo_py_dontcompile.patch
deleted file mode 100644
index 6e634be..0000000
--- a/package/python/python-2.4-020-gentoo_py_dontcompile.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-diff -rduNp Python-2.4.2-010/Python/import.c Python-2.4.2/Python/import.c
---- Python-2.4.2-010/Python/import.c	2005-09-14 20:15:03.000000000 +0200
-+++ Python-2.4.2/Python/import.c	2007-01-22 19:49:18.000000000 +0100
-@@ -822,8 +822,12 @@ static void
- write_compiled_module(PyCodeObject *co, char *cpathname, long mtime)
- {
- 	FILE *fp;
--
--	fp = open_exclusive(cpathname);
-+   char *py_dontcompile = getenv("PYTHON_DONTCOMPILE");
-+   
-+   if (!py_dontcompile) 
-+     fp = open_exclusive(cpathname);
-+   else
-+     fp = NULL;
- 	if (fp == NULL) {
- 		if (Py_VerboseFlag)
- 			PySys_WriteStderr(
diff --git a/package/python/python-2.7-001-cross-compile.patch b/package/python/python-2.7-001-cross-compile.patch
new file mode 100644
index 0000000..d9ac115
--- /dev/null
+++ b/package/python/python-2.7-001-cross-compile.patch
@@ -0,0 +1,103 @@
+diff -rduNp Python-2.7.orig/Makefile.pre.in Python-2.7/Makefile.pre.in
+--- Python-2.7.orig/Makefile.pre.in	2010-04-12 02:10:46.000000000 +0200
++++ Python-2.7/Makefile.pre.in	2010-09-21 16:46:07.000000000 +0200
+@@ -404,8 +404,8 @@ platform: $(BUILDPYTHON)
+ # Build the shared modules
+ sharedmods: $(BUILDPYTHON)
+ 	@case $$MAKEFLAGS in \
+-	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
+-	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
++	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
++	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
+ 	esac
+ 
+ # Build static library
+@@ -538,7 +538,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)
+@@ -920,25 +920,25 @@ 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|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):
+@@ -1043,7 +1043,7 @@ libainstall:	all python-config
+ # 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) \
+diff -rduNp Python-2.7.orig/setup.py Python-2.7/setup.py
+--- Python-2.7.orig/setup.py	2010-06-27 14:36:16.000000000 +0200
++++ Python-2.7/setup.py	2010-09-21 16:59:59.000000000 +0200
+@@ -310,9 +310,9 @@ class PyBuildExt(build_ext):
+         try:
+             imp.load_dynamic(ext.name, ext_filename)
+         except ImportError, why:
+-            self.failed.append(ext.name)
+-            self.announce('*** WARNING: renaming "%s" since importing it'
+-                          ' failed: %s' % (ext.name, why), level=3)
++            self.announce('*** WARNING: Importing "%s" failed, probably '
++                          'because of cross-compilation' % ext.name, level=3)
++            return
+             assert not self.inplace
+             basename, tail = os.path.splitext(ext_filename)
+             newname = basename + "_failed" + tail
+@@ -346,10 +346,6 @@ class PyBuildExt(build_ext):
+         return sys.platform
+ 
+     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 paths specified in the environment variables LDFLAGS and
+         # CPPFLAGS for header and library files.
+         # We must get the values from the Makefile and not the environment
+@@ -384,12 +380,6 @@ class PyBuildExt(build_ext):
+                     for directory in reversed(options.dirs):
+                         add_dir_to_list(dir_list, directory)
+ 
+-        if os.path.normpath(sys.prefix) != '/usr':
+-            add_dir_to_list(self.compiler.library_dirs,
+-                            sysconfig.get_config_var("LIBDIR"))
+-            add_dir_to_list(self.compiler.include_dirs,
+-                            sysconfig.get_config_var("INCLUDEDIR"))
+-
+         try:
+             have_unicode = unicode
+         except NameError:
diff --git a/package/python/python-2.7-002-cross-compile.patch b/package/python/python-2.7-002-cross-compile.patch
new file mode 100644
index 0000000..b1b8770
--- /dev/null
+++ b/package/python/python-2.7-002-cross-compile.patch
@@ -0,0 +1,36 @@
+diff -rduNp Python-2.7.orig/setup.py Python-2.7/setup.py
+--- Python-2.7.orig/setup.py	2010-09-21 17:15:31.000000000 +0200
++++ Python-2.7/setup.py	2010-09-21 17:20:46.000000000 +0200
+@@ -346,6 +346,18 @@ class PyBuildExt(build_ext):
+         return sys.platform
+ 
+     def detect_modules(self):
++        try:
++            modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
++        except KeyError:
++            modules_include_dirs = ['/usr/include']
++        try:
++            modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split()
++        except KeyError:
++            modules_include_dirs = ['/usr/lib']
++        for dir in modules_include_dirs:
++            add_dir_to_list(self.compiler.include_dirs, dir)
++        for dir in modules_lib_dirs:
++            add_dir_to_list(self.compiler.library_dirs, dir)
+         # Add paths specified in the environment variables LDFLAGS and
+         # CPPFLAGS for header and library files.
+         # We must get the values from the Makefile and not the environment
+@@ -388,11 +400,8 @@ class PyBuildExt(build_ext):
+         # 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 = []
+ 
diff --git a/package/python/python-2.7-010-disable_modules_and_ssl.patch b/package/python/python-2.7-010-disable_modules_and_ssl.patch
new file mode 100644
index 0000000..6593ed6
--- /dev/null
+++ b/package/python/python-2.7-010-disable_modules_and_ssl.patch
@@ -0,0 +1,38 @@
+diff -rduNp Python-2.7.orig/setup.py Python-2.7/setup.py
+--- Python-2.7.orig/setup.py	2010-09-21 17:31:52.000000000 +0200
++++ Python-2.7/setup.py	2010-09-21 17:35:20.000000000 +0200
+@@ -21,7 +21,15 @@ from distutils.spawn import find_executa
+ COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
+ 
+ # This global variable is used to hold the list of modules to be disabled.
+-disabled_module_list = []
++try:
++    disabled_module_list = os.environ["PYTHON_DISABLE_MODULES"].split()
++except KeyError:
++    disabled_module_list = list()
++
++try:
++    disable_ssl = os.environ["PYTHON_DISABLE_SSL"]
++except KeyError:
++    disable_ssl = 0
+ 
+ def add_dir_to_list(dirlist, dir):
+     """Add the directory 'dir' to the list 'dirlist' (at the front) if
+@@ -346,6 +354,7 @@ class PyBuildExt(build_ext):
+         return sys.platform
+ 
+     def detect_modules(self):
++        global disable_ssl
+         try:
+             modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
+         except KeyError:
+@@ -685,7 +694,8 @@ class PyBuildExt(build_ext):
+                                      ] )
+ 
+         if (ssl_incs is not None and
+-            ssl_libs is not None):
++            ssl_libs is not None and
++            not disable_ssl):
+             exts.append( Extension('_ssl', ['_ssl.c'],
+                                    include_dirs = ssl_incs,
+                                    library_dirs = ssl_libs,
diff --git a/package/python/python-2.7-020-gentoo_py_dontcompile.patch b/package/python/python-2.7-020-gentoo_py_dontcompile.patch
new file mode 100644
index 0000000..36e35e1
--- /dev/null
+++ b/package/python/python-2.7-020-gentoo_py_dontcompile.patch
@@ -0,0 +1,17 @@
+diff -rduNp Python-2.7.orig/Python/import.c Python-2.7/Python/import.c
+--- Python-2.7.orig/Python/import.c	2010-09-30 12:05:53.000000000 +0200
++++ Python-2.7/Python/import.c	2010-09-30 12:20:38.000000000 +0200
+@@ -886,7 +886,12 @@ write_compiled_module(PyCodeObject *co,
+     mode_t mode = srcstat->st_mode & ~S_IXUSR & ~S_IXGRP & ~S_IXOTH;
+ #endif
+ 
+-    fp = open_exclusive(cpathname, mode);
++    char *py_dontcompile = getenv("PYTHON_DONTCOMPILE");
++
++    if (!py_dontcompile)
++      fp = open_exclusive(cpathname, mode);
++    else
++      fp = NULL;
+     if (fp == NULL) {
+         if (Py_VerboseFlag)
+             PySys_WriteStderr(
-- 
1.7.1


____________________________________________________________________________

This  email  and any  files  transmitted  with it are  confidential  and are
intended solely  for the use of the individual  or entity to which  they are
addressed.  Access to this e-mail by anyone else is unauthorised. If you are
not the  intended recipient,  any disclosure,  copying,  distribution or any
action taken or omitted to be taken in reliance on it, is prohibited. E-mail
messages are not necessarily secure.  Archos does not accept  responsibility
for any changes made to this message after it was sent.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 3/4] python: Add needed extra patches.
  2010-10-12  8:26 [Buildroot] [PATCH 0/4] Move to Python 2.7 Maxime Ripard
  2010-10-12  8:26 ` [Buildroot] [PATCH 1/4] python: Move to version 2.7 Maxime Ripard
  2010-10-12  8:26 ` [Buildroot] [PATCH 2/4] python: Port the existing patches to python2.7 Maxime Ripard
@ 2010-10-12  8:26 ` Maxime Ripard
  2010-12-04  0:00   ` Thomas Petazzoni
  2010-10-12  8:26 ` [Buildroot] [PATCH 4/4] python: Fix make install (Workaround python's bug #1669349) Maxime Ripard
  3 siblings, 1 reply; 7+ messages in thread
From: Maxime Ripard @ 2010-10-12  8:26 UTC (permalink / raw)
  To: buildroot


Signed-off-by: Maxime Ripard <ripard@archos.com>
---
 .../python-2.7-030-fix-long-long-format.patch      |   12 ++++++++
 .../python-2.7-040-bytecode-generation-fix.patch   |   30 ++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)
 create mode 100644 package/python/python-2.7-030-fix-long-long-format.patch
 create mode 100644 package/python/python-2.7-040-bytecode-generation-fix.patch

diff --git a/package/python/python-2.7-030-fix-long-long-format.patch b/package/python/python-2.7-030-fix-long-long-format.patch
new file mode 100644
index 0000000..19f299f
--- /dev/null
+++ b/package/python/python-2.7-030-fix-long-long-format.patch
@@ -0,0 +1,12 @@
+diff -rduNp Python-2.7.orig/configure Python-2.7/configure
+--- Python-2.7.orig/configure	2010-09-30 12:05:54.000000000 +0200
++++ Python-2.7/configure	2010-09-30 12:12:30.000000000 +0200
+@@ -13517,7 +13517,7 @@ $as_echo_n "checking for %lld and %llu p
+   $as_echo_n "(cached) " >&6
+ else
+   if test "$cross_compiling" = yes; then :
+-  ac_cv_have_long_long_format=no
++  ac_cv_have_long_long_format=yes
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
diff --git a/package/python/python-2.7-040-bytecode-generation-fix.patch b/package/python/python-2.7-040-bytecode-generation-fix.patch
new file mode 100644
index 0000000..9c2ae63
--- /dev/null
+++ b/package/python/python-2.7-040-bytecode-generation-fix.patch
@@ -0,0 +1,30 @@
+Index: Python-2.7/Lib/compileall.py
+===================================================================
+--- Python-2.7.orig/Lib/compileall.py	(r??vision 84276)
++++ Python-2.7/Lib/compileall.py	(copie de travail)
+@@ -14,7 +14,6 @@
+ import os
+ import sys
+ import py_compile
+-import struct
+ import imp
+ 
+ __all__ = ["compile_dir","compile_file","compile_path"]
+@@ -83,17 +82,6 @@
+     if os.path.isfile(fullname):
+         head, tail = name[:-3], name[-3:]
+         if tail == '.py':
+-            if not force:
+-                try:
+-                    mtime = int(os.stat(fullname).st_mtime)
+-                    expect = struct.pack('<4sl', imp.get_magic(), mtime)
+-                    cfile = fullname + (__debug__ and 'c' or 'o')
+-                    with open(cfile, 'rb') as chandle:
+-                        actual = chandle.read(8)
+-                    if expect == actual:
+-                        return success
+-                except IOError:
+-                    pass
+             if not quiet:
+                 print 'Compiling', fullname, '...'
+             try:
-- 
1.7.1


____________________________________________________________________________

This  email  and any  files  transmitted  with it are  confidential  and are
intended solely  for the use of the individual  or entity to which  they are
addressed.  Access to this e-mail by anyone else is unauthorised. If you are
not the  intended recipient,  any disclosure,  copying,  distribution or any
action taken or omitted to be taken in reliance on it, is prohibited. E-mail
messages are not necessarily secure.  Archos does not accept  responsibility
for any changes made to this message after it was sent.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 4/4] python: Fix make install (Workaround python's bug #1669349)
  2010-10-12  8:26 [Buildroot] [PATCH 0/4] Move to Python 2.7 Maxime Ripard
                   ` (2 preceding siblings ...)
  2010-10-12  8:26 ` [Buildroot] [PATCH 3/4] python: Add needed extra patches Maxime Ripard
@ 2010-10-12  8:26 ` Maxime Ripard
  3 siblings, 0 replies; 7+ messages in thread
From: Maxime Ripard @ 2010-10-12  8:26 UTC (permalink / raw)
  To: buildroot


Signed-off-by: Maxime Ripard <ripard@archos.com>
---
 package/python/python.mk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/package/python/python.mk b/package/python/python.mk
index 5c85c59..2525adf 100644
--- a/package/python/python.mk
+++ b/package/python/python.mk
@@ -128,7 +128,7 @@ ifneq ($(BR2_PACKAGE_PYTHON_SSL),y)
 endif
 	rm -rf $(PYTHON_DIR)/Lib/test
 	LD_LIBRARY_PATH=$(STAGING_DIR)/lib
-	$(MAKE) CC="$(TARGET_CC)" -C $(PYTHON_DIR) install \
+	$(MAKE) CC="$(TARGET_CC)" -C $(PYTHON_DIR) -i install \
 		DESTDIR=$(TARGET_DIR) CROSS_COMPILE=yes \
 		PYTHON_MODULES_INCLUDE=$(STAGING_DIR)/usr/include \
 		PYTHON_MODULES_LIB="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib" \
-- 
1.7.1


____________________________________________________________________________

This  email  and any  files  transmitted  with it are  confidential  and are
intended solely  for the use of the individual  or entity to which  they are
addressed.  Access to this e-mail by anyone else is unauthorised. If you are
not the  intended recipient,  any disclosure,  copying,  distribution or any
action taken or omitted to be taken in reliance on it, is prohibited. E-mail
messages are not necessarily secure.  Archos does not accept  responsibility
for any changes made to this message after it was sent.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 3/4] python: Add needed extra patches.
  2010-10-12  8:26 ` [Buildroot] [PATCH 3/4] python: Add needed extra patches Maxime Ripard
@ 2010-12-04  0:00   ` Thomas Petazzoni
  2010-12-15 20:12     ` Maxime Ripard
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2010-12-04  0:00 UTC (permalink / raw)
  To: buildroot

Hello Maxime,

Could you provide a bit more details on why those patches are needed ?
We generally want each patch to have a description in the patch itself,
together with the name of the patch author, or the patch source if it
has been borrowed from some other place.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 3/4] python: Add needed extra patches.
  2010-12-04  0:00   ` Thomas Petazzoni
@ 2010-12-15 20:12     ` Maxime Ripard
  0 siblings, 0 replies; 7+ messages in thread
From: Maxime Ripard @ 2010-12-15 20:12 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On 04/12/2010 01:00, Thomas Petazzoni wrote:
> Could you provide a bit more details on why those patches are needed ?
> We generally want each patch to have a description in the patch itself,
> together with the name of the patch author, or the patch source if it
> has been borrowed from some other place.
Here is a new set of patches with details either as header or comments.

Is it ok for you ?

Regards,
Maxime

____________________________________________________________________________

This  email  and any  files  transmitted  with it are  confidential  and are
intended solely  for the use of the individual  or entity to which  they are
addressed.  Access to this e-mail by anyone else is unauthorised. If you are
not the  intended recipient,  any disclosure,  copying,  distribution or any
action taken or omitted to be taken in reliance on it, is prohibited. E-mail
messages are not necessarily secure.  Archos does not accept  responsibility
for any changes made to this message after it was sent.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-python-Port-the-python2.4-patches-to-2.7.patch
Type: text/x-patch
Size: 22613 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101215/1a9c62de/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-python-Add-the-needed-patches-to-compile-python2.7-i.patch
Type: text/x-patch
Size: 3522 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101215/1a9c62de/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-python-Fix-make-install-Workaround-python-s-bug-1669.patch
Type: text/x-patch
Size: 1488 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101215/1a9c62de/attachment-0005.bin>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-12-15 20:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-12  8:26 [Buildroot] [PATCH 0/4] Move to Python 2.7 Maxime Ripard
2010-10-12  8:26 ` [Buildroot] [PATCH 1/4] python: Move to version 2.7 Maxime Ripard
2010-10-12  8:26 ` [Buildroot] [PATCH 2/4] python: Port the existing patches to python2.7 Maxime Ripard
2010-10-12  8:26 ` [Buildroot] [PATCH 3/4] python: Add needed extra patches Maxime Ripard
2010-12-04  0:00   ` Thomas Petazzoni
2010-12-15 20:12     ` Maxime Ripard
2010-10-12  8:26 ` [Buildroot] [PATCH 4/4] python: Fix make install (Workaround python's bug #1669349) Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox