Write action plugins

An action plugin is a subclass of Action, that must interpret its abstract methods.

Selection

An action plugin has an match() method and a priority attribute. To choose which action plugin it should use to compile a foo file, Évariste looks for the action plugin with the highest priority, that matches the file (that is: myplugin.match(foo) returns True). The algorithms looks like the following:

Algorithm to choose the action plugin used to compile a foo file.
# Plugins are sorted by their priority attribute
for plugin in sorted(LIST_OF_ACTION_PLUGINS, reverse=True):
    if plugin.match(foo):
        return plugin

Threads

The compile() action must be thread safe. If not, a Lock is shared by every action plugin (as attribute lock).

Example of usage of lock
def compile(self, path):
    # Thread safe part
    foo()

    with self.lock:
        # Non thread-safe part
        bar()

    # Thread safe part
    baz()