changeset 5404:7a19ab8eeda0

Python: native and python2.6 build patches.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Fri, 24 Jul 2009 13:56:09 +0200
parents 02f34eeb52f9
children 53a9f1d78f1d
files gub/specs/python.py patches/python-2.4.5-native.patch patches/python-2.4.5-python-2.6.patch
diffstat 3 files changed, 129 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gub/specs/python.py	Fri Jul 24 13:55:32 2009 +0200
+++ b/gub/specs/python.py	Fri Jul 24 13:56:09 2009 +0200
@@ -27,6 +27,8 @@
         'python-2.4.2-setup.py-import.patch&strip=0',
         'python-2.4.2-setup.py-cross_root.patch&strip=0',
 #        'python-2.4.2-fno-stack-protector.patch',
+        'python-2.4.5-python-2.6.patch',
+        'python-2.4.5-native.patch',
         ]
 
     def __init__ (self, settings, source):
@@ -37,7 +39,7 @@
         return ['doc', 'devel', 'runtime', '']
 
     def _get_build_dependencies (self):
-        return ['expat-devel', 'zlib-devel', 'tools::python']
+        return ['db-devel', 'expat-devel', 'zlib-devel', 'tools::python']
 
     def patch (self):
         target.AutoBuild.patch (self)
@@ -47,10 +49,15 @@
     def force_autoupdate (self):
         return True
 
+    def autoupdate (self):
+        target.AutoBuild.autoupdate (self)
+        # FIXME: PROMOTEME to target.py?
+        if self.settings.build_platform == self.settings.target_platform:
+            self.file_sub ([('cross_compiling=(maybe|yes)', 'cross_compiling=no')],
+                           '%(srcdir)s/configure')
+
     def makeflags (self):
-#BUILDPYTHON=./python-bin
-#BASECFLAGS='-fno-strict-aliasing -fno-stack-protector'
-        return misc.join_lines (r'''
+       return misc.join_lines (r'''
 BLDLIBRARY='%(rpath)s -L. -lpython$(VERSION)'
 ''')
     def install_command (self):
@@ -62,7 +69,16 @@
     def install (self):
         target.AutoBuild.install (self)
         misc.dump_python_config (self)
-
+        def assert_fine (logger):
+            dynload_dir = self.expand ('%(install_prefix)s/lib/python%(python_version)s/lib-dynload')
+            all = [x.replace (dynload_dir + '/', '') for x in misc.find_files (dynload_dir, '.*.so')]
+            failed = [x.replace (dynload_dir + '/', '') for x in misc.find_files (dynload_dir, '.*failed.so')]
+            if failed:
+                logger.write_log ('failed python modules:' + ', '.join (failed), 'error')
+            if not 'struct.so' in all or not 'itertools.so' in all:
+                logger.write_log ('all python modules:' + ', '.join (all), 'error')
+                raise Exception ('Python struct or itertools module failed')
+        self.func (assert_fine)
     ### Ugh.
     @context.subst_method
     def python_version (self):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/python-2.4.5-native.patch	Fri Jul 24 13:56:09 2009 +0200
@@ -0,0 +1,11 @@
+--- python-2.4.5/configure.in.orig	2009-07-24 11:55:06.282520298 +0200
++++ python-2.4.5/configure.in	2009-07-24 12:00:08.022019995 +0200
+@@ -674,7 +674,7 @@ if test $enable_shared = "yes"; then
+     linux*|Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
+ 	  LDLIBRARY='libpython$(VERSION).so'
+ 	  BLDLIBRARY='-L. -lpython$(VERSION)'
+-	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
++	  RUNSHARED="LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} PYTHONPATH=`pwd`/build/lib.linux-$host_cpu-$VERSION:${PYTHONPATH}"
+ 	  case $ac_sys_system in
+ 	      FreeBSD*|freebsd*)
+ 		SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/python-2.4.5-python-2.6.patch	Fri Jul 24 13:56:09 2009 +0200
@@ -0,0 +1,97 @@
+--- python-2.4.5/Lib/test/test_array.py~	2009-07-23 16:29:11.042519000 +0200
++++ python-2.4.5/Lib/test/test_array.py	2009-07-23 16:30:44.018019000 +0200
+@@ -193,7 +193,7 @@ class BaseTest(unittest.TestCase):
+         self.assert_((a > a) is False)
+         self.assert_((a >= a) is True)
+ 
+-        as = array.array(self.typecode, self.smallerexample)
++        a_s = array.array(self.typecode, self.smallerexample)
+         ab = array.array(self.typecode, self.biggerexample)
+ 
+         self.assert_((a == 2*a) is False)
+@@ -203,12 +203,12 @@ class BaseTest(unittest.TestCase):
+         self.assert_((a > 2*a) is False)
+         self.assert_((a >= 2*a) is False)
+ 
+-        self.assert_((a == as) is False)
+-        self.assert_((a != as) is True)
+-        self.assert_((a < as) is False)
+-        self.assert_((a <= as) is False)
+-        self.assert_((a > as) is True)
+-        self.assert_((a >= as) is True)
++        self.assert_((a == a_s) is False)
++        self.assert_((a != a_s) is True)
++        self.assert_((a < a_s) is False)
++        self.assert_((a <= a_s) is False)
++        self.assert_((a > a_s) is True)
++        self.assert_((a >= a_s) is True)
+ 
+         self.assert_((a == ab) is False)
+         self.assert_((a != ab) is True)
+--- python-2.4.5/Lib/lib-old/Para.py~	2009-07-23 16:38:02.646519000 +0200
++++ python-2.4.5/Lib/lib-old/Para.py	2009-07-23 16:39:40.738020000 +0200
+@@ -60,15 +60,15 @@ class Para:
+     # don't add any new space (but still remove the stretch)
+     def tabto(self, tab):
+         total = 0
+-        as, de = 1, 0
++        a_s, de = 1, 0
+         for i in range(len(self.words)):
+             word = self.words[i]
+             if type(word) is Int: continue
+-            (fo, te, wi, sp, st, as, de) = word
+-            self.words[i] = (fo, te, wi, sp, 0, as, de)
++            (fo, te, wi, sp, st, a_s, de) = word
++            self.words[i] = (fo, te, wi, sp, 0, a_s, de)
+             total = total + wi + sp
+         if total < tab:
+-            self.words.append((None, '', 0, tab-total, 0, as, de))
++            self.words.append((None, '', 0, tab-total, 0, a_s, de))
+     #
+     # Make a hanging tag: tab to hang, increment indent_left by hang,
+     # and reset indent_hang to -hang
+@@ -104,7 +104,7 @@ class Para:
+                         break
+                     i = i+1
+                     continue
+-                fo, te, wi, sp, st, as, de = word
++                fo, te, wi, sp, st, a_s, de = word
+                 if width + wi > avail and width > 0 and wi > 0:
+                     break
+                 if fo is not None:
+@@ -116,7 +116,7 @@ class Para:
+                 lsp = sp
+                 stretch = stretch + st
+                 lst = st
+-                ascent = max(ascent, as)
++                ascent = max(ascent, a_s)
+                 descent = max(descent, de)
+                 i = i+1
+             while i > j and type(words[i-1]) is Int and \
+@@ -157,7 +157,7 @@ class Para:
+                                     h, v)
+                     if ok is not None: return ok
+                     continue
+-                fo, te, wi, sp, st, as, de = word
++                fo, te, wi, sp, st, a_s, de = word
+                 if extra > 0 and stretch > 0:
+                     ex = extra * st / stretch
+                     extra = extra - ex
+@@ -253,7 +253,7 @@ class Para:
+             self.d = None
+     #
+     def _whereisword(self, tuple, word, h1, v1, h2, v2, isfirst, islast):
+-        fo, te, wi, sp, st, as, de = word
++        fo, te, wi, sp, st, a_s, de = word
+         if fo is not None: self.lastfont = fo
+         h = h1
+         if isfirst: h1 = 0
+@@ -302,7 +302,7 @@ class Para:
+         return ok
+     #
+     def _screenposword(self, tuple, word, h1, v1, h2, v2, isfirst, islast):
+-        fo, te, wi, sp, st, as, de = word
++        fo, te, wi, sp, st, a_s, de = word
+         if fo is not None: self.lastfont = fo
+         cc = len(te) + (sp > 0)
+         if self.pos > cc: