Installing Python packages for enigma2

By | August 29, 2008

In a previous post I described how to compile enigma2 for the sh4 arch. That procedure works as expected if you have Python 2.5 or greater. In my case I had Python 2.4 that does not contain some packages that enigma2 requires.

In this post I describe which packages are missing and how to compile and install them.
As before, my target is an STb7109 cut 3.0 board, also called cocoref MB442, that is part of the sh4 arch family.

These are the four packages:

  • elementtree-1.2.6-20050316
  • cElementTree-1.0.5-20051216
  • zope.interface-3.3.0.tar.gz
  • Twisted-8.1.0.tar.bz2

The elementtree and cElementTree packages are needed only if you have Python version <2.5, whilst zope.interface and Twisted must be downloaded and installed independently of the Python version because they are not included in any Python release.

elementtre and cElementTree are used for optimizing XML parsing with low memory use. Typically, cElementTree is 15-20 times faster than the Python version of ElementTree, and uses 2-5 times less memory. Both packages can be downloaded from here: http://effbot.org/zone/celementtree.htm

zope.interface is a web application server that publishes on the web Python objects persisted in an object database such as documents, images and page templates. It can be downloaded from here: http://zope.org/Products/ZopeInterface

Twisted is an event-driven networking engine. It can be downloaded from here: http://twistedmatrix.com/trac


Compiling and installing

Copy the packages to your rootfs and connect to your target. This will be a native compilation, not a cross-compilation as in the previous post.
Remember that PREFIX is the path in your host of the rootfs of your target. In my case is the following. Adjust it according to your configuration:

$ export PREFIX=/opt/oe/STM/STLinux-2.2/devkit/sh4/target

Copy and connect to target:

$ cp elementtree-1.2.6-20050316.tar.gz $PREFIX/home
$ cp cElementTree-1.0.5-20051216.tar.gz $PREFIX/home
$ cp zope.interface-3.3.0.tar.gz $PREFIX/home
$ cp Twisted-8.1.0.tar.bz2 $PREFIX/home
$ ssh root@target

Untar the packages and install them:


elementtree

$ cd /home
$ tar xvfz elementtree-1.2.6-20050316.tar.gz
$ cd elementtree-1.2.6-20050316
$ python setup.py install


cElementTree

$ cd ..
$ tar xvfz cElementTree-1.0.5-20051216.tar.gz
$ cd cElementTree-1.0.5-20051216
$ python setup.py install


zope.interface

$ cd ..
$ tar xvfz zope.interface-3.3.0.tar.gz
$ cd zope.interface-3.3.0
$ python setup.py build


Twisted

$ cd ..
$ tar xvfj Twisted-8.1.0.tar.bz2
$ cd Twisted-8.1.0
$ python setup.py install

As you can see, it’s a very simple and standard procedure normally used for installing Python packages.
However, notice that for installing cElementTree, zope.interface and Twisted, Python will compile C source code. Since this is a native compilation in the target it will take significantly more time than in your host.
Once you have these packages installed enigma2 will not give any errors regarding missing Python packages and will have all its default functionality activated.

One thought on “Installing Python packages for enigma2

Leave a Reply

Your email address will not be published. Required fields are marked *