On (09/09/06 13:19), James Westby wrote: > On (09/09/06 05:44), Adam Cecile wrote: > > A friend told me the file must be python's version independent, what do you > > think about it ? > > > > I'm sorry, I don't understand what you mean. >
After discussion on IRC it seems that a compile flag is wanted to do this. The attached patch adds this. PYTHON_VERSIONS="2.3 2.4" will compile for both versions. If it is not given it defaults to the default python version. It causes scons to warn about multiple environments, but I don't know scons, so I'm not sure whether this is a problem, or indeed if it just a limitation of the system that you can't do multiple things with one file. I should note that I haven't actually tested that the files do indeed work when installed. James -- James Westby -- GPG Key ID: B577FE13 -- http://jameswestby.net/ seccure key - (3+)k7|M*edCX/.A:n*N!>|&7U.L#9E)Tu)T0>AM - secp256r1/nistp256
diff -u museek+-0.1.11/debian/rules museek+-0.1.11/debian/rules --- museek+-0.1.11/debian/rules +++ museek+-0.1.11/debian/rules @@ -11,13 +11,15 @@ CFLAGS = Wall,fPIC,g,O2 endif +PYVERS = $(shell pyversions -sv) + build: build-stamp build-stamp: dh_testdir # Run configure and build with scons - scons CFLAGS="$(CFLAGS)" QTDIR=/usr/share/qt3/ + scons CFLAGS="$(CFLAGS)" QTDIR=/usr/share/qt3/ PYTHON_VERSIONS="$(PYVERS)" touch build-stamp @@ -27,7 +29,7 @@ rm -f build-stamp # Run scons -c for cleaning - scons QTDIR=/usr/share/qt3/ -c + scons QTDIR=/usr/share/qt3/ -c PYTHON_VERSIONS="$(PYVERS)" # Dirty hacks for scons -c issues ./clean @@ -43,7 +45,7 @@ dh_installdirs # Install files - scons PREFIX=/usr MANDIR=/usr/share/man/man1 DESTDIR=$(CURDIR)/debian/tmp install + scons PREFIX=/usr MANDIR=/usr/share/man/man1 DESTDIR=$(CURDIR)/debian/tmp PYVERSIONS="$(PYVERS)" install # Build architecture-dependent files here. binary-arch: build install only in patch2: unchanged: --- museek+-0.1.11.orig/pymuseekd/museek/SConscript +++ museek+-0.1.11/pymuseekd/museek/SConscript @@ -13,9 +13,15 @@ """) import sys, os -py_ver = str(sys.version_info[0]) + "." + str(sys.version_info[1]) -py_dest = env['DESTDIR'] + os.path.join(sys.prefix, "lib", "python" + py_ver, "site-packages", "museek") +py_vers = env['PYTHON_VERSIONS'].split(" ") + +install = [] + +for py_ver in py_vers: + + py_dest = env['DESTDIR'] + os.path.join(sys.prefix, "lib", "python" + py_ver, "site-packages", "museek") + + install.append(env.Install(py_dest, files)) -install = env.Install(py_dest, files) env.Alias('install_pymuseekd', install) env.Alias('install', 'install_pymuseekd') only in patch2: unchanged: --- museek+-0.1.11.orig/Mucipher/python/SConscript +++ museek+-0.1.11/Mucipher/python/SConscript @@ -11,28 +11,34 @@ def file_copy(target, source, env): open(str(target[0]), "w").write(open(str(source[0])).read()) -py_ver = str(sys.version_info[0]) + "." + str(sys.version_info[1]) -py_inc = os.path.join(sys.prefix, "include", "python" + py_ver) +py_vers = env['PYTHON_VERSIONS'].split(" ") -if os.path.exists(os.path.join(py_inc, "Python.h")): - env_swigpy = Environment(tools = ['default', 'swig']) - env_swigpy.SConsignFile() - - env_swigpy.Append(CPPPATH = env['CPPPATH'] + [py_inc]) - env_swigpy.Append(LIBPATH = env['LIBPATH_MUCIPHER']) - env_swigpy.Append(LIBS = ['ucipher']) - env_swigpy.Replace(SHLIBPREFIX='') - - env_swigpy.Command("mucipher.i", "../mucipher.i", file_copy) - env_swigpy.Command("wraphelp.c", "../wraphelp.c", file_copy) - - mucipherc = env_swigpy.SharedLibrary('_mucipherc', sources, SWIGFLAGS='-python') - - py_dest = env['DESTDIR'] + os.path.join(sys.prefix, "lib", "python" + py_ver, "site-packages") - - install = env.Install(py_dest, source = [ mucipherc, 'mucipherc.py', 'mucipher.py']) - - env.Alias('install_mucipher', install) - env.Alias('install', 'install_mucipher') -else: - print "WARNING: Python.h include not found, please install Python's development packages" +install = [] + +for py_ver in py_vers: + + py_inc = os.path.join(sys.prefix, "include", "python" + py_ver) + + if os.path.exists(os.path.join(py_inc, "Python.h")): + env_swigpy = Environment(tools = ['default', 'swig']) + env_swigpy.SConsignFile() + + env_swigpy.Append(CPPPATH = env['CPPPATH'] + [py_inc]) + env_swigpy.Append(LIBPATH = env['LIBPATH_MUCIPHER']) + env_swigpy.Append(LIBS = ['ucipher']) + env_swigpy.Replace(SHLIBPREFIX='') + + env_swigpy.Command("mucipher.i", "../mucipher.i", file_copy) + env_swigpy.Command("wraphelp.c", "../wraphelp.c", file_copy) + + mucipherc = env_swigpy.SharedLibrary('_mucipherc', sources, SWIGFLAGS='-python') + + py_dest = env['DESTDIR'] + os.path.join(sys.prefix, "lib", "python" + py_ver, "site-packages") + + install.append(env.Install(py_dest, source = [ mucipherc, 'mucipherc.py', 'mucipher.py'])) + + else: + print "WARNING: Python.h include not found for python %s, please install Python's development packages" % py_ver + +env.Alias('install_mucipher', install) +env.Alias('install', 'install_mucipher') only in patch2: unchanged: --- museek+-0.1.11.orig/SConstruct +++ museek+-0.1.11/SConstruct @@ -2,6 +2,7 @@ from muscons import * import os +import re import sys import string import SCons @@ -47,7 +48,9 @@ opts.Add(BoolOption('RELAY_QSA', 'Use relaytool to generate run-time conditional linking for QSA', '')) opts.Add(BoolOption('BINRELOC', 'Support binary relocation', '')) opts.Add(BoolOption('LIBXMLPP_STATIC', 'Horrible hack to statically link against libxml++', '')) - +opts.Add('PYTHON_VERSIONS', 'Space separated list of python versions ' + +'to build for, e.g. "2.3 2.4"', + str(sys.version_info[0]) + "." + str(sys.version_info[1])) # Set up our environment @@ -204,6 +207,14 @@ sys_h.write("#define SIZE_SHORT %s\n" % size_short) sys_h.write("#define SIZE_LONGINT %s\n\n" % size_longint) +pyvers = r'\d\.\d( \d\.\d)*' +pyvers_re = re.compile(pyvers) +pyvers_match = pyvers_re.match(env['PYTHON_VERSIONS']) + +if pyvers_match is None: + raise SCons.Errors.UserError('Invalid value for PYTHON_VERSIONS %s' % + env['PYTHON_VERSIONS']) + # Check for system specific includes @@ -379,7 +390,6 @@ SConscript(os.path.join(dir, 'SConscript'), build_dir = bd, duplicate = 1) - # Save the options we want to have saved (basically, everything but DESTDIR) print env['DESTDIR'] f = open("mulocal.py", "w") @@ -405,4 +415,5 @@ f.write('QT_LIB = %s\n' % (`env['QT_LIB']`)) f.write('QT_MOC = %s\n' % (`env['QT_MOC']`)) f.write('QT_UIC = %s\n' % (`env['QT_UIC']`)) +f.write('PYTHON_VERSIONS = %s\n' % (`env['PYTHON_VERSIONS']`)) f.close() only in patch2: unchanged: --- museek+-0.1.11.orig/mucous/pymucous/SConscript +++ museek+-0.1.11/mucous/pymucous/SConscript @@ -7,9 +7,16 @@ """) import sys, os -py_ver = str(sys.version_info[0]) + "." + str(sys.version_info[1]) -py_dest = env['DESTDIR'] + os.path.join(sys.prefix, "lib", "python" + py_ver, "site-packages", "pymucous") -install = env.Install(py_dest, files) +py_vers = env['PYTHON_VERSIONS'].split(" ") + +install = [] + +for py_ver in py_vers: + + py_dest = env['DESTDIR'] + os.path.join(sys.prefix, "lib", "python" + py_ver, "site-packages", "pymucous") + + install.append(env.Install(py_dest, files)) + env.Alias('install_mucous', install) env.Alias('install', 'install_mucous')
signature.asc
Description: Digital signature