Supercharge your mach commands with external Python packages

Gregory Szorc gps at
Sat Sep 21 00:17:50 UTC 2013

The "mach" script in the root directory of mozilla-central is a generic
command dispatching tool. Have a piece of commonly used functionality
useful to many people? Create a mach command so others can use it easily!

While mach started with commands dealing with build system interaction
and running tests, it has since evolved to provide additional
functionality. For example, run |mach mercurial-setup| to help you
ensure an optimal Mercurial experience. Run |mach uuid| to generate a
new UUID. Run |mach update-uuids| to automatically change the UUID of an

Until recently, mach commands were mostly limited to using functionality
exposed in the tree. Wanted to use an external Python package to get
work done? It wasn't exactly easy. Now, with the work in bug 794506,
it's trivial for mach commands to install external Python packages at
run-time. See the implementation of |mach build-docs| [1] for an example.

The possibilities here are really endless since there are so many
packages in PyPI - the Python Package Index [2]. Some crazy ideas:

* Install Mercurial and have access to the Mercurial API (but watch out
for MPL-GPL license mismatch)
* Install hg-git and add commands for converting between Mercurial and Git
* Install dulwich (Git implemented in Python) for interacting with Git
* Install Node.js through
and leverage Node for voodoo
* Install mozdownload ( to
download pre-built builds (I have some nefarious ideas for this
involving bootstrapping the build system)
* Install MozillaPulse ( to
subscribe to automation events in near real time.

There's, uh, a lot of cool stuff you can do with this. I encourage you
to explore and contribute your awesomeness back to the tree so others
can more easily leverage your work. Scratch your own itches then package
them as mach commands so others can do the same.

As a disclaimer, if you install something using mach, it *may* interfere
with the build system. This shouldn't happen. But if it does, you've
been forewarned.



More information about the firefox-dev mailing list