Buildout recipe to do binary compiles of .py and .po files; helps with ownership dilemmas
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is even with plone:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Buildout recipe to precompiles Python and locale files in an egg list.

Why precompilation?

Python ordinarily compiles .py files into .pyc or .pyo byte code files on demand. Likewise, applications like Plone often compile .po locale files into .mo representations when needed.

However, if you are running a Python application as a daemon and wish to prevent write access to code directories, you want to do these compilations at buildout-time, not run-time. That's where this recipe comes in. Passed an egg list, it will pick up all the eggs in the buildout working set for the list and find and compile .py and .mo files in place.

.mo file compilation is optional, and must be turned on.


Please note that usage changed with release 0.5. If you need the old options, use 0.4

Common usage:

parts =
eggs = ...

recipe = plone.recipe.precompiler
eggs = ${buildout:eggs}
compile-mo-files = true

This recipe may return harmless warnings regarding the inability to compile skin layer scripts, which typically have "return" outside of a function. While these warnings are harmless, you may suppress them by tuning the skip list.


recipe = plone.recipe.precompiler

eggs = required: list of eggs

compile-mo-files = true/false; default is false

extra-paths = optional list of additional paths
that would not be found from eggs in multiple indented lines
quiet = true/false; if true, common errors are only shown when buildout's
verbose flag is set.


This recipe was created for use in Plone installers, but is hopefully useful in many buildout contexts.