changeset 6206:8021db07ffb8

Prepare for python-2.6 transition. tools.py: add python version switch. Also, rename python-2-6 to python-2.6 and add python-2.4 package.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Tue, 28 Aug 2012 10:29:46 +0200
parents bd0d8fb7845d
children 895c23f49db3
files gub/specs/python-2-6.py gub/specs/python-2.4.py gub/specs/python-2.6.py gub/tools.py
diffstat 4 files changed, 97 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/gub/specs/python-2-6.py	Tue Aug 28 14:10:40 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-from gub import target
-from gub import tools
-from gub.specs import python
-
-class Python_2_6 (python.Python):
-    source = 'http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tar.bz2'
-    dependencies = [
-        'db-devel',
-        'expat-devel',
-        'zlib-devel',
-        'tools::python-2-6'
-        ]
-    patches = [
-        'python-2.6.4.patch',
-        'python-configure.in-posix.patch&strip=0',
-        'python-2.6.4-configure.in-sysname.patch',
-        'python-2.4.2-configure.in-sysrelease.patch',
-        'python-2.4.2-setup.py-import.patch&strip=0',
-        'python-2.6.4-setup.py-cross_root.patch',
-#        'python-2.4.2-fno-stack-protector.patch',
-#        'python-2.4.5-python-2.6.patch',
-        'python-2.4.5-native.patch',
-#        'python-2.4.5-db4.7.patch',
-        'python-2.6.4-configure.in-cross.patch',
-        'python-2.6.4-include-pc.patch',
-        'python-2.6.4-setup-cross.patch',
-        ]
-    config_cache_overrides = python.Python.config_cache_overrides + '''
-ac_cv_have_chflags=no
-ac_cv_have_lchflags=no
-ac_cv_py_format_size_t=no
-'''
-    so_modules = [
-        '_struct',
-        'datetime',
-        'itertools',
-        'time',
-        ]
-
-class Python_2_6__mingw (python.Python__mingw):
-    source = Python_2_6.source
-    patches = Python_2_6.patches + [
-        'python-2.4.2-winsock2.patch',
-        'python-2.4.2-setup.py-selectmodule.patch',
-        'python-2.4.5-disable-pwd-mingw.patch',
-        'python-2.4.5-mingw-site.patch',
-        'python-2.4.5-mingw-socketmodule.patch',
-        ]
-    dependencies = [
-        'db-devel',
-        'expat-devel',
-        'zlib-devel',
-        'tools::python-2-6',
-        ]
-    config_cache_overrides = python.Python__mingw.config_cache_overrides + '''
-ac_cv_have_chflags=no
-ac_cv_have_lchflags=no
-ac_cv_py_format_size_t=no
-'''
-    so_modules = Python_2_6.so_modules
-    def patch (self):
-        python.Python__mingw.patch (self)
-        self.system ('cd %(srcdir)s && cp -pv PC/dl_nt.c Python/fileblocks.c')
-    def generate_dll_a_and_la (self, libname, depend=''):
-        target.AutoBuild.generate_dll_a_and_la (self, 'python2.6', depend)
-
-class Python_2_6__tools (python.Python__tools):
-    source = Python_2_6.source
-    patches = [
-        'python-2.6.4-readline.patch',
-        'python-2.6.4-setup-cross.patch',
-        ]
-    dependencies = ['autoconf', 'libtool']
-    force_autoupdate = True
-    make_flags = python.Python__tools.make_flags
-    so_modules = Python_2_6.so_modules
-    def patch (self):
-        tools.AutoBuild.patch (self)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/python-2.4.py	Tue Aug 28 10:29:46 2012 +0200
@@ -0,0 +1,11 @@
+from gub import target
+from gub import tools
+from gub.specs import python
+
+class Python_2_4 (python.Python): pass
+class Python_2_4__mingw (python.Python__mingw): pass
+class Python_2_4__tools (python.Python__tools): pass
+class Python_2_4__mingw_binary (python.Python__mingw_binary): pass
+class Python_2_4__freebsd (python.Python__freebsd): pass
+class Python_2_4__mingw (python.Python__mingw): pass
+class Python_2_4__tools (python.Python__tools): pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/python-2.6.py	Tue Aug 28 10:29:46 2012 +0200
@@ -0,0 +1,78 @@
+from gub import target
+from gub import tools
+from gub.specs import python
+
+class Python_2_6 (python.Python):
+    source = 'http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tar.bz2'
+    dependencies = [
+        'db-devel',
+        'expat-devel',
+        'zlib-devel',
+        'tools::python',
+        ]
+    patches = [
+        'python-2.6.4.patch',
+        'python-configure.in-posix.patch&strip=0',
+        'python-2.6.4-configure.in-sysname.patch',
+        'python-2.4.2-configure.in-sysrelease.patch',
+        'python-2.4.2-setup.py-import.patch&strip=0',
+        'python-2.6.4-setup.py-cross_root.patch',
+#        'python-2.4.2-fno-stack-protector.patch',
+#        'python-2.4.5-python-2.6.patch',
+        'python-2.4.5-native.patch',
+#        'python-2.4.5-db4.7.patch',
+        'python-2.6.4-configure.in-cross.patch',
+        'python-2.6.4-include-pc.patch',
+        'python-2.6.4-setup-cross.patch',
+        ]
+    config_cache_overrides = python.Python.config_cache_overrides + '''
+ac_cv_have_chflags=no
+ac_cv_have_lchflags=no
+ac_cv_py_format_size_t=no
+'''
+    so_modules = [
+        '_struct',
+        'datetime',
+        'itertools',
+        'time',
+        ]
+
+class Python_2_6__mingw (python.Python__mingw):
+    source = Python_2_6.source
+    patches = Python_2_6.patches + [
+        'python-2.4.2-winsock2.patch',
+        'python-2.4.2-setup.py-selectmodule.patch',
+        'python-2.4.5-disable-pwd-mingw.patch',
+        'python-2.4.5-mingw-site.patch',
+        'python-2.4.5-mingw-socketmodule.patch',
+        ]
+    dependencies = [
+        'db-devel',
+        'expat-devel',
+        'zlib-devel',
+        'tools::python-2-6',
+        ]
+    config_cache_overrides = python.Python__mingw.config_cache_overrides + '''
+ac_cv_have_chflags=no
+ac_cv_have_lchflags=no
+ac_cv_py_format_size_t=no
+'''
+    so_modules = Python_2_6.so_modules
+    def patch (self):
+        python.Python__mingw.patch (self)
+        self.system ('cd %(srcdir)s && cp -pv PC/dl_nt.c Python/fileblocks.c')
+    def generate_dll_a_and_la (self, libname, depend=''):
+        target.AutoBuild.generate_dll_a_and_la (self, 'python2.6', depend)
+
+class Python_2_6__tools (python.Python__tools):
+    source = Python_2_6.source
+    patches = [
+        'python-2.6.4-readline.patch',
+        'python-2.6.4-setup-cross.patch',
+        ]
+    dependencies = ['autoconf', 'libtool']
+    force_autoupdate = True
+    make_flags = python.Python__tools.make_flags
+    so_modules = Python_2_6.so_modules
+    def patch (self):
+        tools.AutoBuild.patch (self)
--- a/gub/tools.py	Tue Aug 28 14:10:40 2012 +0200
+++ b/gub/tools.py	Tue Aug 28 10:29:46 2012 +0200
@@ -1,4 +1,5 @@
 import os
+import re
 import sys
 #
 from gub import build
@@ -7,6 +8,10 @@
 from gub import misc
 from gub import octal
 
+python_version = '2.4'
+python_version = '2.6'
+python_version = ''
+
 def get_cross_build_dependencies (settings):
     return []
 
@@ -29,6 +34,9 @@
     if (not package.get_dependency_dict ().get ('', None)
         and not package.get_dependency_dict ().get ('devel', None)):
         def get_build_dependencies (foo):
+            if python_version:
+                package.dependencies = [re.sub ('python$', 'python-' + python_version, name)
+                                        for name in package.dependencies]
             # If a package depends on tools::libtool, ie not on
             # libltdl, we still also need <target-arch>::libtool,
             # because of our update_libtool ().  We fix this here,