Category: Firefox

Firefox Add-on SDK Oplop Dev Environment

2011/11/26 | by Doug [mail] | Categories: Computing, Python, Firefox

I had to jump through some hoops to get a development environment set up to work on creating a Firefox 4+ add-on that implement’s Oplop. The difficulties all had to do with virtualenvs.

The Firefox Add-on SDK (aka Jetpack) uses a virtualenv but I want to keep the dependencies for Oplop development in a project-specific virtualenv, not in the firefox-addon-sdk-1.2.1 one. I use virtualenvwrapper so I added postactivate and predeactivate hooks to make it easy to switch between the 2 virtualenvs. The postactivate hook is:

Code:

SDK_DIR=$HOME/Documents/devel/firefox-addon-sdk-1.2.1
ADDON_DIR=$HOME/Documents/devel/firefox/oplop-addon/Firefox/add-on
 
alias sdk='cd $SDK_DIR && source bin/activate && cd $ADDON_DIR'

and the predeactivate just destroys the sdk alias as a cleanup.

For development, Oplop requires Jinja2 and SCons. Jinja2 is easily installed in a virtualenv with pip, but Scons doesn’t play nice with pip and I ran into this issue. Fortunately that’s easily remedied by downloading the scons tarball, unpacking it and installing with python setup.py install (with the project virtualenv activated, of course).

With that all in place I can use workon oplop-firefox-addon to activate the virtualenv where Jinja2 and Scons are available and use Scons to render templates, etc., then use sdk to flip to the firefox-addon-sdk-1.2.1 virtualenv to use cfx to test the add-on.

Permalink

Doug's Home Blog

A private blog for life, cycling, and my computing fiddlings.

April 2014
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        

Misc

XML Feeds

What is RSS?

powered by b2evolution free blog software