torsdag den 31. januar 2008

Installing ZMySQLDA in Zope using buildout on Ubuntu and perhaps Debian in general

Another note to future self. This is how I did it.

libmysql++-dev

To make Zope work with Mysql I needed to compile the database adapter. For this I needed the mysql dev libraries. On Ubuntu that is done like this:
aptitude install libmysql++-dev

MySQL-Python


For ZMySQLDA to work I needed the plain Python MySQL-Python library installed and compiled.

Luckily the MySQL-Python package is distributed as an egg, so it can just be added to buildout.cfg
eggs =
... other packages
MySQL-Python
Buildout will then download, compile and install the package automatically.


ZMySQLDA

ZMySQLDA is old. Latest release 2.0.8 is from 2001. But that is just because it is stable. No worry.

When I tried to install it with by adding it in the buildout.cfg:
urls = http://www.zope.org/Members/adustman/Products/ZMySQLDA/2.0.8/ZMySQLDA-2.0.8.tar.gz
It made a small tarbomb and put itself inside a directory structure like:
lib/python/Products/ZMySQLDA
And Zope was not be able to find it.

Buildout to the rescue again. Radim Novotny has made a buildout recipe for doing it right:
http://pypi.python.org/pypi/cns.recipe.zmysqlda/
So all I needed was a few additions to the buildout.cfg

[buildout]
parts =
...
zmysqlda
and
[zmysqlda]
recipe = cns.recipe.zmysqlda
target = ${buildout:directory}/products

And then I was good to go.

2 kommentarer:

thisfred sagde ...

Hi,

thanks for this writeup, which was exactly what I was looking for. One thing I can't figure out though: for me Zope doesn't start because DA.py (line 155) is looking for an image in a Zope folder that presumably in buildout lives somewhere else. Did you not run into this problem? I guess not, or you would have mentioned, huh? :)

I guess somehow my buildout recipe puts things in different places...

thisfred sagde ...

Never mind, found it: ZMySQLDa isn't ready for Zope 2.11 yet.

Fiddle fix:

change line 96:

from ImageFile import ImageFile

to:

from App.ImageFile import ImageFile

(found here: http://www.zopera.org/Members/senacle/ForumPost.2008-08-01.5842)