Sunday, December 09, 2007

Ubuntu Python Upgrading

The other day I went to a SyPy. One interesting thing I learnt from a Canonical employee I was talking to there is what caused a much duplicated glChess bug. The symptoms of the bug are basically glChess crashes on startup while upgrading due to not being able to import the glchess module. Unfortunately as an Ubuntu upgrade can take some time users tend to be looking for some small task to amuse themselves; say, playing a game :)

I'm not 100% sure of all the details but essential the following occurs when python files are upgraded in Ubuntu:
At some point in the upgrade the site-packages Python directory (which contains all the python modules to import) is moved/symlinked out of the way. This is done to avoid binary incompatibilities between .pyc files between Python versions. The .pycs are rebuilt and then the directory returns.

What this means for application developers like me... Files installed into bin/ directories remain so a user can launch the application but the libraries have dissappeared so the application will fail with an ImportError exception.

I'm not convinced the upgrade needs to be this dramatic as .pyc files are only a load optimisation but this means that the ImportError should be caught at the top level and the user warned they have an invalid install (a good thing to report anyway) or they are upgrading and must wait for the upgrade to complete.
Post a Comment