[maemo-developers] PyMaemo now optified (in extras-devel)!

From: Anderson Lizardo anderson.lizardo at openbossa.org
Date: Mon Nov 16 16:56:17 EET 2009

I uploaded to fremantle extras-devel a new package called
"pymaemo-optify" and an updated version of python2.5 that depends on
this package. It basically implements the idea proposed by Andrew
Flegg of using "mount --bind" to relocate the biggest Python
directories to /opt:


This does not cover all files installed by PyMaemo packages, juts the
biggest ones. Only handling the above already cuts more than 20MB from
root filesystem, just for a simple "apt-get install python-gtk2". More
directories can be added later if necessary, through updates to the
"pymaemo-optify" package.

pymaemo-optify should correctly handle upgrades, migrating the above
directories to /opt/pymaemo and "mount --bind" ing them back to their
location. So for most users, simply run update on the Application
Manager and all these directories will magically go to /opt (and any
packages that install files under these directories will be
automatically optified too), thus freeing up precious storage on root

The optified Python installation will naturally migrate to
extras-testing once some Python application gets promoted. For now,
use extras-devel to try it.

How to optify a Python application?

If your application is already modular and installs modules to
/usr/lib/python2.5/site-packages, your application will be
automatically optified. If your application consists of a single
script installed under /usr/bin, the recommended way is to make it
into a module installed to /usr/lib/python2.5/site-packages , with a
"main"  method that can be called from the /usr/bin script. Example:

Instead of a single /usr/bin/my_app script with:


You can have a /usr/lib/python2.5/site-packages/my_app.py with:

def main():

And have a /usr/bin/my_app with something like:

import my_app

This is just a suggestion though, developers are free to design their
code as they like.


- optify /usr/bin/python2.5 (it seems a symlink should work, after
some testing we will upload a new version of python2.5 to reduce
around 1 MB from root fs usage.

Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil
More information about the maemo-developers mailing list