Open Bug 1041575 Opened 11 years ago Updated 3 years ago

Require or ship a Python templating library (Jinja2, Mako)

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(Not tracked)

People

(Reporter: nalexander, Unassigned)

Details

For the mobile/android project generation stuff, I'd like to move away from hand-crafted string mangling (based on templates and the preprocessor) and toward a template engine. A quick scan of the source tree suggests that we don't ship such a template engine. This, and the build system as a whole, are standardizing on Python; the front-runners appear to be Jinja2 and Mako. We seem to be using Jinja2 as part of AMO; we seem to be using Mako as part of the Legacy Sync server-full. I'd be happy to make a template library a Python pre-req that is not shipped with the tree, but I don't know if we have any /other/ out-of-tree pre-reqs. The list at [1] makes it look like everything is shipped in tree. If it's not too difficult, I could make a template library an optional pre-req required only for |mach build-backend -b=Android*|. There's precedent for that with |mach build-docs|. Thoughts? [1] http://hg.mozilla.org/mozilla-central/file/0dc711216018/build/virtualenv_packages.txt
We could certainly leverage a templating engine for output formatting in mach commands. Installing a package dynamically at mach command time is doable. I'm not crazy about doing it inside config.status, but if it's in code paths that don't run in automation, that's fine by me. My vote is to install from pip on demand like |mach build-docs| does it and to transition to in-tree distribution if/when others start using it. Python brain trust: what templating engine sucks the least?
Flags: needinfo?(erik)
Flags: needinfo?(chris.lonnen)
fwiw, in releng we use Flask a lot, which uses templates from Jinja2, it has served us quite well, you can easily add extensions to how it works (e.g. new global vars, etc.) So if my vote counts, thatd be my choice.
jinja2 is the standard. We like it so much we ported it to JS (http://nunjucks.jlongster.com/).
Flags: needinfo?(chris.lonnen)
Yep, Jinja2. We use it in Django. I use it in DXR for HTML and even config files. Armin, it's main maintainer, is one of the guiding lights of the Python community. It mucks with tracebacks to make it very easy to debug templating errors. You can't go wrong.
Flags: needinfo?(erik)
Product: Core → Firefox Build System
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.