Experimental Minefield PyXPCOM development package
This is a self-contained package which includes the code from
extensions/python/dom. It is packaged as an installable bundle (add-on), which makes it easy to get started with coding in Python on the Mozilla platform.
- Minefield (built against Gran Paradiso alpha8, other builds may not work)
- Python matching the version the extension was built with:
- 2.5.1 on Linux (stock Ubuntu Feisty package)
- 2.5 on win32 (the one from MozillaBuild)
- A Linux or win32 platform
Getting PyXPCOM to work from an extension requires jumping through several hoops.
First, the module search path needs to be adjusted, so that the required modules can be loaded from the extension directory. This was straightforward, following the example that adds
libpyxpcom.so (and its equivalent on other platforms) is required by all Python code (the module loader, the _xpcom module, etc). Normally, you adjust the library search path (for example, via
LD_LIBRARY_PATH) and the world is happiness and glee. However, I haven't found out a good way of doing that from an extension, if it is at all possible. Instead,
libpyxpcom.so registers itself as a component observing
xpcom-startup, and thus is already loaded at the time the other modules need it. This is quite a hack, but it works. Notably, it forces loading the library even if nobody needs it.
- PyXPCOM page on MDC