PYXPCOM
Python Cross Platform Component Object Model
This technology will replace our local web server in release 0.6 and beyond.
Benefits
- PyXPCOM will make increase the products stability a great deal, getting rid of connection loss problems with HTTP and nevow.
- It will enable us to replace most of the javascript code with more structured python objects.
- It will get rid of mozilla security problems using xpcom components (which we are currently doing from javascript).
- It will mean that we don't need to reduce the security to nothing in the mozilla profile and turn off security at the top of every javascript function
- There will be no need to make our own firefox profile directory on installation
- The user will be able to open other web browsers and instances of firefox while running exe
- We will be able to have a "quit" option in the file menu
Developer Info
Here's how to get pyxpcom working on you machine.
Summary
- Install distcc
- Download older version of autoconf (autoconf213-2.13-9.noarch.rpm)
- Download mozilla source code
- Download patch and apply patch - https://bugzilla.mozilla.org/attachment.cgi?id=186062
- create attachment:.mozconfig file
- Download and build Python2.4.1
- ./configure --prefix=/usr --debug --enable-unicode=ucs2
- compile everything
distcc
DistCC helps us compile things much faster by using everyone elses cpu. However when building mozilla, the build breaks more, so probably best not to use it.
compiling
If you want to use distcc: export PATH=/usr/lib/distcc/bin:$PATH # Put distcc bin first
- cd to mozilla dir
- autoconf-2.13
- ./configure
- make # (make -j24 if using distcc)
- (Make coffee, go home, sleep, come back if not using distcc)
- (If something doesn't build, just cd to that dir, and type make in it, then go back to the mozilla source dir and type 'make' again and carry on)
installing
- from the mozilla source dir
- sudo make install
Calling XPCOM from Python
Once you've compiled and installed everything
- ln -s /home/djm/work/firefox/mozilla/extensions/python/xpcom/src/lib_xpcom.so _xpcom.so
- (If developing, its nice to run with your work dir)
- rm -rf /usr/lib/MozillaFirefoxOptimized/lib/firefox-1.0.4/python
- ln -s /home/djm/work/firefox/mozilla/extensions/python /usr/lib/MozillaFirefoxOptimized/lib/firefox-1.0.4/python
- export LD_LIBRARY_PATH="/usr/lib/MozillaFirefoxOptimized/lib/firefox-1.0.4"
- export PYTHONPATH=/usr/lib/MozillaFirefoxOptimized/lib/firefox-1.0.4/python
- export MOZILLA_FIVE_HOME=/usr/lib/MozillaFirefoxOptimized/lib/firefox-1.0.4 (or whereever your .so files live)
- /usr/local/lib/python
{{{import xpcom from xpcom import components f=components.classes@mozilla.org/supports-float;1.createInstance(components.interfaces.nsISupportsFloat) f.data=3.1415926 print f.toString()}}}
Links to PyXPCOM Resouces
- http://live.gnome.org/Epiphany_2fEphyPython_2fPyXPCOM
- PyXPCOMTroubleShooting
- http://zacbowling.com/projects/gtkembedmoz/ http://zacbowling.com/blog/2005/04/22/carbon-based-unit-2/
- http://severna.homeip.net/gtkmozwin32.php
- https://bugzilla.mozilla.org/show_bug.cgi?id=256560
- http://www.haskell.org/pipermail/libraries/2005-March.txt
- http://www.daa.com.au/pipermail/pygtk/2005-June/010394.html
- http://www.niccolai.ws/read_blob.php?&news_id=18
- UIStrategies
Attachments (2)
- .mozconfig (2.4 KB) - 2009-05-22.
- dot.mozconfig (2.4 KB) - 2009-05-22.