changeset 6209:e8095501db4e

Eradicate hardcoded python2.4, softcode using tools.python_version.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Tue, 28 Aug 2012 12:20:01 +0200
parents 08125e83bb42
children 969b798f4d5c
files gub/debian.py gub/sources.py gub/specs/boost.py gub/specs/ctypes.py gub/specs/lilypond.py gub/specs/pycairo.py gub/specs/pygobject.py gub/specs/pygtk.py gub/specs/pygtksourceview.py gub/specs/pypoppler.py gub/specs/pysqlite.py
diffstat 11 files changed, 50 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/gub/debian.py	Tue Aug 28 11:52:31 2012 +0200
+++ b/gub/debian.py	Tue Aug 28 12:20:01 2012 +0200
@@ -7,6 +7,7 @@
 from gub import context
 from gub import cross
 from gub import misc
+from gub.tools import python_version
 
 mirror = 'http://ftp.de.debian.org/debian'
 
@@ -177,6 +178,6 @@
     'libtool-runtime': ['libltdl3'],
     'libiconv-devel': ['libiconv2'],
     'pango': ['libpango1.0-0'],
-    'python-devel': ['python2.4-dev'],
-    'python-runtime': ['python2.4'],
+    'python-devel': ['python%(python_version)s-dev' % globals ()],
+    'python-runtime': ['python%(python_version)s' % globals ()],
     }
--- a/gub/sources.py	Tue Aug 28 11:52:31 2012 +0200
+++ b/gub/sources.py	Tue Aug 28 12:20:01 2012 +0200
@@ -43,7 +43,7 @@
 netpbm = join (gub, 'netpbm-patched-10.35.tar.bz2')
 pkg_config = 'http://pkg-config' + join (freedesktop, 'pkg-config-0.20.tar.gz')
 potrace = join (sf, 'potrace/potrace-1.7.tar.gz')
-python = 'http://python.org/ftp/python/%(version)s/Python-2.4.2.tar.bz2'
+python = 'http://python.org/ftp/python/%(version)s/Python-2.6.4.tar.bz2'
 imagemagick = 'ftp://ftp.nluug.nl/pub/ImageMagick/ImageMagick-6.4.1-3.tar.bz2'
 texinfo = join (gnu, 'texinfo/texinfo-4.8.tar.bz2')
 ghostscript  = 'ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/gs860/ghostscript-8.60.tar.bz2'
--- a/gub/specs/boost.py	Tue Aug 28 11:52:31 2012 +0200
+++ b/gub/specs/boost.py	Tue Aug 28 12:20:01 2012 +0200
@@ -103,6 +103,7 @@
         self.func (defer)
 
 class BjamBuild_v1 (target.MakeBuild):
+    python_version = tools.python_version
     @context.subst_method
     def CFLAGS (self):
         return ''
@@ -113,7 +114,7 @@
 '-sGCC=%(toolchain_prefix)sgcc -fPIC -DBOOST_PLATFORM_CONFIG=\\"boost/config/platform/linux.hpp\\"'
 '-sGXX=%(toolchain_prefix)sg++ -fPIC -DBOOST_PLATFORM_CONFIG=\\"boost/config/platform/linux.hpp\\"'
 '-sBUILD=release <optimization>space <inlining>on <debug-symbols>off <runtime-link>static'
-'-sPYTHON_VERSION=2.4'
+'-sPYTHON_VERSION=%(python_version)s'
 '-scxxflags=-fPIC'
 --layout=system
 --builddir=%(builddir)s
@@ -122,7 +123,7 @@
 --libdir=%(prefix_dir)s/lib
 --includedir=%(prefix_dir)s/include
 --verbose
-''')
+'''
     install_command = (compile_command
                        .replace ('=%(prefix_dir)s', '=%(install_prefix)s')
                        + ' install')
--- a/gub/specs/ctypes.py	Tue Aug 28 11:52:31 2012 +0200
+++ b/gub/specs/ctypes.py	Tue Aug 28 12:20:01 2012 +0200
@@ -1,4 +1,5 @@
 from gub import target
+from gub import tools
 
 class Ctypes (target.PythonBuild):
     source = 'http://surfnet.dl.sourceforge.net/sourceforge/ctypes/ctypes/1.0.2/ctypes-1.0.2.tar.gz'
@@ -8,6 +9,7 @@
         'libffi',
         'python',
         ]
+    python_version = tools.python_version
     def patch (self):
         target.PythonBuild.patch (self)
         def defer (logger):
@@ -22,7 +24,7 @@
 from distutils.command import build_ext
 build_ext.build_ext._get_libraries = build_ext.build_ext.get_libraries
 def get_libraries (self, ext):
-    return self._get_libraries (ext) + ['python2.4']
+    return self._get_libraries (ext) + ['python%(python_version)s']
 build_ext.build_ext.get_libraries = get_libraries
 '''
             setup = self.expand ('%(srcdir)s/setup.py')
@@ -43,9 +45,9 @@
 ' --infodir=%(prefix_dir)s/share/info'
 ' --mandir=%(prefix_dir)s/share/man'
 ' --libdir=%(prefix_dir)s/lib'
-' CFLAGS=-I%(system_prefix)s/include/python2.4'
+' CFLAGS=-I%(system_prefix)s/include/python%(python_version)s'
 ]
-'''
+''' 
 )],
                        '%(srcdir)s/setup.py')
         self.file_sub ([("""LIBFFI_SOURCES='source/libffi'""",
@@ -56,14 +58,14 @@
     patches = Ctypes.patches + [
         'ctypes-mingw.patch',
         ]
-    install_command = 'cd %(srcdir)s && SO=%(so_extension)s LDSHARED="$CC -shared" LDFLAGS="-L%(system_prefix)s/bin -lpython2.4" CFLAGS="-DMS_WIN32" python %(srcdir)s/setup.py install --prefix=%(prefix_dir)s --root=%(install_root)s'
+    install_command = 'cd %(srcdir)s && SO=%(so_extension)s LDSHARED="$CC -shared" LDFLAGS="-L%(system_prefix)s/bin -lpython%(python_version)s" CFLAGS="-DMS_WIN32" python %(srcdir)s/setup.py install --prefix=%(prefix_dir)s --root=%(install_root)s'
     def patch (self):
         Ctypes.patch (self)
         self.file_sub ([('-fPIC', '-DMS_WIN32',)], '%(srcdir)s/setup.py')
-        self.file_sub ([('''[[]'python2.4'[]]''',
-                         '''['python2.4', 'ffi', 'ole32', 'oleaut32', 'uuid']''')],
+        self.file_sub ([('''[[]'python%(python_version)s'[]]''',
+                         '''['python%(python_version)s', 'ffi', 'ole32', 'oleaut32', 'uuid']''')],
                        '%(srcdir)s/setup.py')
     def install (self):
         Ctypes.install (self)
-        self.system ('cd %(install_prefix)s/lib/python2.4/site-packages && mv _ctypes.so _ctypes.dll')
-        self.system ('cd %(install_prefix)s/lib/python2.4/site-packages && mv _ctypes_test.so _ctypes_test.dll')
+        self.system ('cd %(install_prefix)s/lib/python%(python_version)s/site-packages && mv _ctypes.so _ctypes.dll')
+        self.system ('cd %(install_prefix)s/lib/python%(python_version)s/site-packages && mv _ctypes_test.so _ctypes_test.dll')
--- a/gub/specs/lilypond.py	Tue Aug 28 11:52:31 2012 +0200
+++ b/gub/specs/lilypond.py	Tue Aug 28 12:20:01 2012 +0200
@@ -6,8 +6,10 @@
 from gub import misc
 from gub import repository
 from gub import target
+from gub import tools
 from gub import versiondb
 from gub.specs import ghostscript
+from gub.tools import python_version
 
 VERSION='v2.14'
 def url (version=VERSION):
@@ -51,6 +53,7 @@
         'system::mf', 
         'system::mpost', 
         ]
+    python_version = tools.python_version
     if 'stat' in misc.librestrict ():
         dependencies = [x for x in dependencies
                         if x not in ['system::mf', 'system::mpost']
@@ -225,7 +228,7 @@
             'libfontconfig1-dev',
             'libfreetype6-dev',
             'libglib2.0-dev',
-            'python2.4-dev',
+            'python%(python_version)s' % globals (),
             'libpango1.0-dev',
             'zlib1g-dev',
             'urw-fonts',
--- a/gub/specs/pycairo.py	Tue Aug 28 11:52:31 2012 +0200
+++ b/gub/specs/pycairo.py	Tue Aug 28 12:20:01 2012 +0200
@@ -1,4 +1,5 @@
 from gub import target
+from gub import tools
 
 class Pycairo (target.AutoBuild):
 # python 2.6
@@ -8,7 +9,8 @@
 #    source = 'http://cairographics.org/releases/pycairo-1.6.4.tar.gz'
     force_autoupdate = True
     source = 'http://cairographics.org/releases/pycairo-1.4.12.tar.gz'
-    configure_command = ('PYTHON=%(tools_prefix)s/bin/python PYTHON_INCLUDES=-I%(system_prefix)s/include/python2.4 '
+    python_version = tools.python_version
+    configure_command = ('PYTHON=%(tools_prefix)s/bin/python PYTHON_INCLUDES=-I%(system_prefix)s/include/python%(python_version)s '
                          + target.AutoBuild.configure_command)
     patches = [
         'pycairo-cross.patch',
@@ -20,4 +22,4 @@
 
 class Pycairo__mingw (Pycairo):
     configure_variables = (Pycairo.configure_variables
-                  + ' LDFLAGS="-L%(system_prefix)s/bin -lpython2.4"')
+                  + ' LDFLAGS="-L%(system_prefix)s/bin -lpython%(python_version)s"')
--- a/gub/specs/pygobject.py	Tue Aug 28 11:52:31 2012 +0200
+++ b/gub/specs/pygobject.py	Tue Aug 28 12:20:01 2012 +0200
@@ -1,4 +1,5 @@
 from gub import target
+from gub import tools
 
 class Pygobject (target.AutoBuild):
     source = 'http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.16/pygobject-2.16.1.tar.gz'
@@ -10,7 +11,8 @@
     def aclocal_path (self):
         return (target.AutoBuild.aclocal_path (self)
                 + ['%(srcdir)s/m4', '%(srcdir)s'])
-    configure_command = ('PYTHON=%(tools_prefix)s/bin/python PYTHON_INCLUDES=-I%(system_prefix)s/include/python2.4 '
+    python_version = tools.python_version
+    configure_command = ('PYTHON=%(tools_prefix)s/bin/python PYTHON_INCLUDES=-I%(system_prefix)s/include/python%(python_version)s '
                          + target.AutoBuild.configure_command)
     patches = [
         'pygobject-cross.patch',
@@ -31,7 +33,7 @@
         'pygobject-mingw.patch',
         ]
     configure_variables = (Pygobject.configure_variables
-                  + ' LDFLAGS="-L%(system_prefix)s/bin -lpython2.4"')
+                  + ' LDFLAGS="-L%(system_prefix)s/bin -lpython%(python_version)s"')
     config_cache_overrides = target.AutoBuild.config_cache_overrides + '''
 ac_cv_setwakeupfd_ok=no
 '''
--- a/gub/specs/pygtk.py	Tue Aug 28 11:52:31 2012 +0200
+++ b/gub/specs/pygtk.py	Tue Aug 28 12:20:01 2012 +0200
@@ -1,4 +1,5 @@
 from gub import target
+from gub import tools
 
 class Pygtk (target.AutoBuild):
     source = 'http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.16/pygtk-2.16.0.tar.gz'
@@ -10,7 +11,8 @@
     def aclocal_path (self):
         return (target.AutoBuild.aclocal_path (self)
                 + ['%(srcdir)s/m4', '%(srcdir)s'])
-    configure_command = ('PYTHON_INCLUDES=-I%(system_prefix)s/include/python2.4 '
+    python_version = tools.python_version
+    configure_command = ('PYTHON_INCLUDES=-I%(system_prefix)s/include/python%(python_version)s '
                          + target.AutoBuild.configure_command)
     patches = [
         'pygtk-cross.patch',
@@ -32,4 +34,4 @@
 ac_cv_setwakeupfd_ok=no
 '''
     configure_variables = (Pygtk.configure_variables
-                  + ' LDFLAGS="-L%(system_prefix)s/bin -lpython2.4"')
+                  + ' LDFLAGS="-L%(system_prefix)s/bin -lpython%(python_version)s"')
--- a/gub/specs/pygtksourceview.py	Tue Aug 28 11:52:31 2012 +0200
+++ b/gub/specs/pygtksourceview.py	Tue Aug 28 12:20:01 2012 +0200
@@ -1,16 +1,18 @@
+from gub import misc
 from gub import target
-from gub import misc
+from gub import tools
 
 class Pygtksourceview (target.AutoBuild):
     source = 'http://ftp.gnome.org/pub/gnome/sources/pygtksourceview/2.10/pygtksourceview-2.10.1.tar.gz'
+    python_version = tools.python_version
     configure_command = (misc.join_lines ('''
 PYTHON=%(tools_prefix)s/bin/python
 PYTHON_HOME=%(system_prefix)s
-PYTHON_VERSION=2.4
-PYTHON_GTK_DIR=%(system_prefix)s/lib/python2.4/site-packages
-PYTHON_INCLUDES=-I%(system_prefix)s/include/python2.4
-PYTHON_LIBS="-L%(system_prefix)s/bin -lpython2.4"
-PYTHON_PKG_DIR=%(prefix_dir)s/lib/python2.4/site-packages
+PYTHON_VERSION=%(python_version)s
+PYTHON_GTK_DIR=%(system_prefix)s/lib/python%(python_version)s/site-packages
+PYTHON_INCLUDES=-I%(system_prefix)s/include/python%(python_version)s
+PYTHON_LIBS="-L%(system_prefix)s/bin -lpython%(python_version)s"
+PYTHON_PKG_DIR=%(prefix_dir)s/lib/python%(python_version)s/site-packages
 ''')
                          + target.AutoBuild.configure_command)
     dependencies = [
--- a/gub/specs/pypoppler.py	Tue Aug 28 11:52:31 2012 +0200
+++ b/gub/specs/pypoppler.py	Tue Aug 28 12:20:01 2012 +0200
@@ -1,4 +1,5 @@
 from gub import target
+from gub import tools
 
 class Pypoppler (target.AutoBuild):
     # for poppler-glib 0.12
@@ -17,7 +18,8 @@
         'poppler',
         ]
     force_autoupdate = True
-    configure_command = ('PYTHON=%(tools_prefix)s/bin/python PYTHON_INCLUDES=-I%(system_prefix)s/include/python2.4 '
+    python_version = tools.python_version
+    configure_command = ('PYTHON=%(tools_prefix)s/bin/python PYTHON_INCLUDES=-I%(system_prefix)s/include/python%(python_version)s '
                          + target.AutoBuild.configure_command)
     def autoupdate (self):
         self.file_sub ([(r'pkg-config ', r'$PKG_CONFIG ')], '%(srcdir)s/configure.ac')
@@ -30,4 +32,4 @@
 
 class Pypoppler__mingw (Pypoppler):
     configure_variables = (Pypoppler.configure_variables
-                  + ' LDFLAGS="-L%(system_prefix)s/bin -lpython2.4"')
+                  + ' LDFLAGS="-L%(system_prefix)s/bin -lpython%(python_version)s"')
--- a/gub/specs/pysqlite.py	Tue Aug 28 11:52:31 2012 +0200
+++ b/gub/specs/pysqlite.py	Tue Aug 28 12:20:01 2012 +0200
@@ -1,8 +1,10 @@
 from gub import target
+from gub import tools
 
 class Pysqlite (target.PythonBuild):
     source = 'http://pypi.python.org/packages/source/p/pysqlite/pysqlite-2.6.0.tar.gz'
     subpackage_names = ['']
+    python_version = tools.python_version
     def patch (self):
         def defer (logger):
             dist_fix = '''
@@ -16,14 +18,14 @@
 from distutils.command import build_ext
 build_ext.build_ext._get_libraries = build_ext.build_ext.get_libraries
 def get_libraries (self, ext):
-    return self._get_libraries (ext) + ['python2.4']
+    return self._get_libraries (ext) + ['python%(python_version)s']
 build_ext.build_ext.get_libraries = get_libraries
 '''
             setup = self.expand ('%(srcdir)s/setup.py')
             s = open (setup).read ()
             open (setup, 'w').write (self.expand (dist_fix) + s)
         self.func (defer)
-    install_command = 'cd %(srcdir)s && SO=%(so_extension)s LDSHARED="$CC -shared" LDFLAGS="-L%(system_prefix)s/bin -lpython2.4" CFLAGS="--verbose" python %(srcdir)s/setup.py install --prefix=%(prefix_dir)s --root=%(install_root)s'
+    install_command = 'cd %(srcdir)s && SO=%(so_extension)s LDSHARED="$CC -shared" LDFLAGS="-L%(system_prefix)s/bin -lpython%(python_version)s" CFLAGS="--verbose" python %(srcdir)s/setup.py install --prefix=%(prefix_dir)s --root=%(install_root)s'
     dependencies = [
         'sqlite',
         'tools::setuptools',
@@ -32,4 +34,4 @@
 class Pysqlite__mingw (Pysqlite):
     def install (self):
         Pysqlite.install (self)
-        self.system ('cd %(install_prefix)s/lib/python2.4/site-packages/pysqlite2 && mv _sqlite.so _sqlite.dll')
+        self.system ('cd %(install_prefix)s/lib/python%(python_version)s/site-packages/pysqlite2 && mv _sqlite.so _sqlite.dll')