Freevo Plugin Writing HOWTO: Writing your own plugins for Freevo
Prev |  |

# Chapter 5. Plugin Distribution

If you wrote a plugin, it would be nice to send it to the Freevo mailing list. If you like (and we), we could integrate the plugin into the Freevo distribution. If you don't want that, or your plugin is very special and we won't include it, there is a way to build an external plugin with the Freevo distutils as installer. We will add a plugin (or a link to a plugin) on the Freevo homepage if it's build for the Freevo distutils.

The Freevo distutils are an enhancement for Freevo of the normal Python distutils. To install a plugin, the user only needs to call freevo install tarball.tgz. To make this work, the plugin needs to use the same directory structure as the Freevo distribution and a `setup.py` and `MANIFEST.in` file in the root directory.

The directory structure should only conatin the needed directories and an empty `__init__.py` in the plugin directory. The `__init__.py` is needed by Python. Since the `__init__.py` isn't empty for `plugins/idlebar/`, it's not possible to write external idlebar plugins at the moment (you could place it in the normal plugin dir, that works). We are working on a solution to fix that. E.g if your plugin is a video plugin (video.foo) and contains one image `foo.png`, the directory structure may look like this:

    root
      |--> setup.py
      |--> MANIFEST.in
      |
      |--> share
      | |--> images
      | | |--> foo.png
      |
      |--> src
      | |--> video
      | | |--> plugins
      | | | |--> __init__.py (empty)
      | | | |--> foo.py

The MANIFEST.in file describes a list of files to be included in the distribution (you can build a source distribution by calling python setup.py sdist).

    recursive-include src *.py
    recursive-include share *
    include *

The `setup.py` script is a Python distutils script with some default attributes for Freevo. If the plugin uses the Freevo file structure, a setup script could look like this:

    #!/usr/bin/env python

    """Setup script for my freevo plugin."""

    __revision__ = "$Id: setup.py 4298 2003-11-15 12:31:34Z dischi $"

    from distutils.core import setup, Extension
    import distutils.command.install
    import freevo.util.distutils

    # now start the python magic
    setup (name = "nice_plugin",
           version = '0.1',
           description = "My first plugin",
           author = "me",
           author_email = "my@mail.address",
           url = "http://i-also-have-a-web.address",

           package_dir = freevo.util.distutils.package_dir,
           packages = freevo.util.distutils.packages,
           data_files = freevo.util.distutils.data_files
           )

For more details about the parameter for the setup function, read the Python manual.

Prev | Home |
i18n support |  |