|Version 6 (modified by athomas, 10 years ago) (diff)|
Example plugin from edgewall.com
A component that handles HTTP requests and extends the navigation bar.
More information at edgewall.com.
Copy and paste this.
Authoritative instructions here, but reproduced below:
The egg file needs to have a file named trac_plugin.txt in its EGG-INFO directory. This file should contain the names of all modules that need to be imported by Trac to register your components.
Note that this will change in the very near future: setuptools 0.6 will introduce the concept of “entry points”, which will be used instead of the trac_plugin.txt descriptor.. See trac:TracPlugins for details.
A plugin can either be deployed globally, or only for a specific environment. Global deployment is done by installing the plugin:
$ cd /path/to/pluginsource $ python setup.py install
To deploy a plugin only to a specific Trac environment, copy the egg file into the plugins directory of that environment:
$ cd /path/to/pluginsource $ python setup.py bdist_egg $ cp dist/*.egg /path/to/projenv/plugins
During development of a plugin, it is inconvenient to have to install it in either of the ways described above. Instead, you should use the setuptools develop command:
$ cd /path/to/pluginsource $ python setup.py develop --install-dir=/path/to/projenv/plugins
You can omit the --install-dir argument to make the development version of your plugin available globally.
This will install an .egg-link file instead of the actual egg. That file is basically a link to the source directory of your plugin, so that Trac will always see the latest version of your code.
A tutorial to build your own plugins is available here: EggCookingTutorial