Jorge Monforte’s heracles

heracles is a project by Jorge Monforte which can parse and render configuration files. It is based on augeas.

Summary

heracles is designed to work with Python2, having been specifically tested with Python2.6 and 2.7.

Like augeas, heracles uses “lenses” which allow parsing and rendering of a variety of common Linux configuration files. Augeas is a c-based library which also provides Python bindings, whereas heracles goes further in allowing straight access to the parser functions from Python

The idea of a “lens parser” is derived from Boomerang, and is a “well-behaved bidirectional transformation” beween text and tree, which allows re-writing parts of a file while leaving the rest of the file untouched. As such a lens parser normally has two siginificant methods: get and put.

Rendering

The code provides an

Running

Run the unparser, with the commands:

$ python2.6
>>> from heracles import Heracles

Conclusion