Running `python-spidermonkey` on JeOS
Paul Davis’ python-spidermonkey project looks brilliant.
In a nutshell, he’s building a Python bridge to Mozilla’s SpiderMonkey “JavaScript on C” environment. I’m excited about that, because it means I might be able to put together a headless testing environment without trying to make everything work correctly inside Rhino. Hooray for options!
I ran into a snag or two while getting up and running on JeOS (my dev environment of choice), so I’m documenting the process here.
- 
    Install python headers and pkg-config. Forgetting to installpgk-configwill give you some exciting errors in the compilation phase later on that make it sound like NSPR failed to install correctly. If you’re on JeOS, it’s more likely the case that you don’t havepkg-configat all:sudo apt-get install python2.6-dev pkg-config
- 
    Install netscape portable runtime: sudo apt-get install libnspr4-dev
- 
    Pull down python-spidermonkey mkdir -p ~/src cd ~/src git clone git://github.com/davisp/python-spidermonkey.gitnsp
- 
    Build python-spidermonkeycd ~/src/python-spidermonkey python setup.py build
- 
    Test python-spidermonkey:Actually, don’t do this. One of the tests fails on JeOS, and it fails in a way that sucks up all your resources and leaves you in an infinite loop. Yay! 
- 
    Install: Even though the max time test fails (spectacularly), the bridge seems to work pretty well. Install the package anyway, just don’t rely on being able to set a max execution time on your code. :) sudo python setup.py install
Now, to see about getting JSLint running in this environment… Fun!
— Mike West