tags:

views:

89

answers:

2

In Trac on Admin -> Plugins there is an option to install Plug-ins. Now this option expect you to upload an Python egg.

This would be all well but for the fact that all the Trac plug-ins I found are either plain .py files or zip files and are incompatible with the upload function (I tried it).

This leaves my with a bunch of questions:

  • Are there any Trac plug-ins which come as an Python egg?
  • What is an (Trac compatible) Python egg?
  • Is it difficult to repackage an .py file into a Trac compatible Python egg?
  • If not: how is it done?
A: 

Haven't used trac for a year, but what I remember is that most plugins are available trough subversion and already packed as an egg (which is kind of an installer in the python world, but I am not very familiar with the concept).

Most plugins are available at http://trac-hacks.org/ and the easiest way to install a plugin is

easy_install http://svn.domain.tdl/path/to/plugin/

the folder should contain a setup.py and a setup.cfg file. easy_install checks the files out from svn and installs the plugin. You can find details here: http://trac.edgewall.org/wiki/TracPlugins

If the plugin makes database changes you have to call

trac-admin upgrade

from console.

http://trac.edgewall.org/wiki/TracAdmin

If I remember right, the install through the webinterface installs the plugin locally (for the instance) while easy_install installs it globally (for all running trac sites) and is the more common way to install a plugin.

Hint: After every plugin install you have to restart trac Hint2: Most plugins don't tell you how to install and only give a link to the root of their svn. You only have to browse the svn folder and locate the folder containing the setup.py. The rest is done with easy_install.

Example:

Plugin: http://trac-hacks.org/wiki/GoogleChartPlugin

Wiki pages tells you: You can check out GoogleChartPlugin from here using Subversion, or browse the source with Trac.

where here links to http://trac-hacks.org/svn/googlechartplugin/

The svn contains two versions. Browse to http://trac-hacks.org/svn/googlechartplugin/0.11/trunk/ and copy the path.

Then do

easy_install http://trac-hacks.org/svn/googlechartplugin/0.11/trunk/
SchlaWiener
I see. Basically you need Console access to install plug-ins. Which I don't have.
Martin
If you have console access, easy_install is the prefered way of installing a plugin. If not, installation through the web interface should be possible (I believe you even won't need to restart trac. However, reflection my own experience, maintaining a trac installation without full access to the server is not a preferable situation. You'll need trac admin once in a while and often you need to change values in trac.ini (but that can be done with a plugin, too.
SchlaWiener
+1  A: 

Answers to your questions in order.

  • Python eggs are binary packages which contain the code for the application and some metadata. They're not very different from debs or rpms in this sense. The egg itself is basically just a zip file which contains all the above mentioned files with specific names and layouts. For more information on eggs (the format and how to create them), please refer to http://www.ibm.com/developerworks/library/l-cppeak3.html. It's probably a little dated since the future (and present) of python packaging is a little hazy.
  • A trac plugin is a python program that uses the Trac plugin API to extend the functionality of trac. It can be packaged as an egg.
  • If your package is properly laid out and contains a setuptools/distribute setup.py file, then issuing the command python setup.py bdist_egg will create a .egg file for you. For details on this please refer to this(a little dated but complete) and this (more upto date but still in progress). The Trac Growl plugin mentions this on it's documentation page.
  • Please see above point.
Noufal Ibrahim