24 Feb 2004 lgs   » (Master)

Somebody told me Python is an easy language and it's fun to program with it. Very true. But what about Python development? Specifically Python bindings development? Well, it's a nightmare, I can tell you.

After having my first GtkGrid version released yesterday (0.0.1) I decided to make the Python bindings today. It began very good: I understood pretty well how the h2def.py, override files and python-codegen.py works all together to create a Python C module.

But then problems started to arrive in no particular order. First my gtkgrid module didn't get imported properly and I got an undefined reference to a function codegen was putting on grid.c. After asking to gjc he told me it was probably a bug in codegen. So I filled a bug report in bugzilla and to my surprise gjc had a patch 20 minutes later!! This is user support and not what some big companies claim they do. I applied the patch and everything worked smoothly. :)

So next step was to show my cute small binding to the world but proper autotools stuff was needed for that because I was using a hard coded Makefile to build the module. And this is where the second part of the nightmare began.

I looked at the diacanvas2 Makefile.am/configure.in files. I looked at the pygtk Makefile.am/configure.in files and I copied everything pretty literal but it didn't work. I copied the pygtk autogen.sh file and some m4 macros and got some errors fixed, but still didn't work. After more than 2 hours reading autotools documentation and trying different aproaches I go really frustrated. I was also a little bit tired.

Then I give distutils a try and can you believe it? In less than 5 minutes I got it working. So after a whole day my conclusions are:

  • pygtk developers are really nice guys that will help you
  • autotools are a nightmare only designed to make your head explode
  • Python tools are nice and you should use them and avoid using C tools for things different than C.

Well, let's see if somebody gets interested in the (in)famous Grid

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!