From feeb15340ab73fc830bd5e77c5ab8c0376f556c5 Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Mon, 7 Mar 2011 14:00:59 +0000
Subject: [PATCH] When building Python modules, struct module is not available
 yet and is required by gettext which is in turn required by optparse (used in
 setup.py to parse CPPFLAGS and LDFLAGS), thus catch gettext import error in
 Lib/optparse.py, likewise Python 2.6.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44016 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...ackport-CPPFLAGS-setup-from-python2.6.patch | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/patches/python2.4-backport-CPPFLAGS-setup-from-python2.6.patch b/patches/python2.4-backport-CPPFLAGS-setup-from-python2.6.patch
index 999dd30050..bc78bc23d7 100644
--- a/patches/python2.4-backport-CPPFLAGS-setup-from-python2.6.patch
+++ b/patches/python2.4-backport-CPPFLAGS-setup-from-python2.6.patch
@@ -71,3 +71,21 @@ the fix from Python 2.6.
          # Add paths to popular package managers on OS X/darwin
          if sys.platform == "darwin":
              # Fink installs into /sw by default
+--- Lib/optparse.py	2006-05-29 03:15:43.000000000 +0900
++++ Lib/optparse.py	2011-03-07 21:20:17.192000789 +0900
+@@ -69,7 +69,13 @@
+ import sys, os
+ import types
+ import textwrap
+-from gettext import gettext as _
++
++try:
++    from gettext import gettext
++except ImportError:
++    def gettext(message):
++        return message
++_ = gettext
+ 
+ def _repr(self):
+     return "<%s at 0x%x: %s>" % (self.__class__.__name__, id(self), self)
+
-- 
2.30.9