Build Python in Buildout

erstellt von Jens W. Klein — Jul 17, 2008 08:10 PM

zc.buildout to build a custom python.

Python-LogoSystems Python is sometimes polluted with different packages from somewhere. This happens and deleting packages conflicting with the specific Buildout is not the clean solution.

Having a clean Python helps a lot. It can be shared between buildouts. Python is easy to build anyway, but using Buildout for this task its again easier and more predictable and reduces the affinity for mistakes. Here is my buildout.cfg for this task.

[buildout]
python = python
parts =
    python
    pythonbin

[python]
recipe = zc.recipe.cmmi
url = http://www.python.org/ftp/python/2.4.5/Python-2.4.5.tgz
executable = ${buildout:directory}/parts/python/bin/python2.4
extra_options=
    --enable-unicode=ucs4
    --with-threads
    --with-readline

[pythonbin]
recipe = plone.recipe.command
command = ln -s ${python:executable} ${buildout:bin-directory}/python

If youre on OSX you want to add MACOSX_DEPLOYMENT_TARGET=10.5 to extra_options. The python is binary-compatible (pickles, ZODB) with Debian/Ubuntus (and most others) binary - it uses the same unicode flavor.

If youre on Debian/Ubuntu you want to do first:
sudo apt-get install libreadline5-dev zlib1g-dev libbz2-dev libssl-dev libjpeg62-dev

I think its also a good idea to use this style of python-build for the new plone.org deployment setup. [UPDATE: While testing this for new.plone.org I changed pythonbin to just symlink the binary; UPDATE2: Added some information for Debian/Ubuntu]

Artikelaktionen