ShedSkin

Shed Skin is an experimental compiler, that can translate pure, but implicitly statically typed Python programs into optimized C++. It can generate stand-alone programs or extension modules that can be imported and used in larger Python programs.

For more information, check out http://code.google.com/p/shedskin/

On a simple test I could see a speed improvement of up to 18 times. The great thing is, you can more or less write normal python and then let ShedSkin convert it to C code, so it can get compiled by gcc. To see an application which uses Shedskin, have a look in SleepAnalyser. It has one file "mylib.py" which gets normal imported into the python application. How ever if there is a file mylib.so in the same folder, python will use that one.

How to use it in scratchbox

Install scratchbox as described in http://wiki.maemo.org/Documentation/Maemo_5_Final_SDK_Installation . Then install Shedskin with "apt-get install shedskin" from the Extras-Devel repository.

There is also a good tutorial of how to use it: http://shedskin.googlecode.com/files/shedskin-tutorial-0.6.html .

How to use it with the autobuilder

First of all, try to test it on your device with the deb-package generated in scratchbox. Do not forget to change the architecture to ARMEL, else it will not run:

 sb-conf se FREMANTLE_ARMEL
 dpkg-buildpackage -sa -rfakeroot -k<my email address>


Missing depencies

The generated module is dependant on some other modules. When you have the module on your phone or in scratchbox, you can see the dependencies with ldd:

 ldd
       libgc.so.1 => not found
       libpcre.so.3 => /usr/lib/libpcre.so.3 (0x40053000)
       libpthread.so.0 => /lib/libpthread.so.0 (0x40079000)
       libdl.so.2 => /lib/libdl.so.2 (0x4009a000)
       libutil.so.1 => /lib/libutil.so.1 (0x400a5000)
       libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 (0x400b0000)
       libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x401d4000)
       libm.so.6 => /lib/libm.so.6 (0x402b7000)
       libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4032d000)
       libc.so.6 => /lib/libc.so.6 (0x40340000)
       /lib/ld-linux.so.3 (0x2a000000)

There you also will see if a dependency is missing and you have to add it to your package. In the above example you can see that libgc is missing, so you should add it as a dependency to your application.