Python 2.4 on Debian multiarch
I recently had to work on a project that needed Python 2.4. "Not a problem", I thought, "I'll just compile a Python and be on my way". However the bz2 module wasn't available. Strange, since the libbz2-dev package was definitely installed. Eventually 2 things dawned on me:
- The hazy memory of me sitting, beer in hand, deciding "Yeah, I'll go multiarch, it'll all work fine I'm sure"
- That modifying LDFLAGS isn't enough, there's all sorts of magic going on in setup.py.
setup.py basically looks in hardcoded paths for libraries, and because I'd gone multiarch the library was now in /lib/x86_64-linux-gnu/libbz2.so.1
. By the time mutiarch came about, python 2.4 was too old for people to want to patch it.
However, given cmmi lets you patch files before you build, I took Martijn Pieters' example off stackoverflow and came up with:
[buildout]
python = python
parts +=
python
pythonbin
[python]
recipe = zc.recipe.cmmi
url = http://www.python.org/ftp/python/2.4.6/Python-2.4.6.tgz
executable = ${buildout:directory}/parts/python/bin/python2.4
patch = http://files.shuttlethread.com/patches/python2.4-addmultiarch.patch
patch_options = -p1
extra_options=
--enable-unicode
--with-threads
--with-readline
[pythonbin]
recipe = plone.recipe.command
command = ln -s ${python:executable} ${buildout:bin-directory}/python
Don't look too closely at the patch in question though. It's a bit ugly, and I couldn't be bothered to tidy it. You get a working Python though, which is the main thing.