Koozali.org: home of the SME Server

Trac plugins enabling python plugin egg cache

Offline 7eis

  • *
  • 47
  • +0/-0
Trac plugins enabling python plugin egg cache
« on: May 20, 2008, 09:49:39 PM »
I wish to enable the Calendar plugin for trac installed using the contrib provided.

I downloaded the files, installed the plugin, enabled it in the trac.ini and updated the trac using /link/to/trac1/trac update.

Now this is what I get
Quote
Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 406, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 206, in dispatch
    req.hdf = HDFWrapper(loadpaths=chrome.get_all_templates_dirs())
  File "/usr/lib/python2.3/site-packages/trac/web/chrome.py", line 263, in get_all_templates_dirs
    dirs += provider.get_templates_dirs()
  File "build/bdist.linux-i686/egg/azcalendar/azcalendar.py", line 308, in get_templates_dirs
  File "/usr/lib/python2.3/site-packages/pkg_resources.py", line 799, in resource_filename
    return get_provider(package_or_requirement).get_resource_filename(
  File "/usr/lib/python2.3/site-packages/pkg_resources.py", line 1188, in get_resource_filename
    return self._extract_resource(manager, zip_path)
  File "/usr/lib/python2.3/site-packages/pkg_resources.py", line 1193, in _extract_resource
    last = self._extract_resource(
  File "/usr/lib/python2.3/site-packages/pkg_resources.py", line 1204, in _extract_resource
    real_path = manager.get_cache_path(self.egg_name, self._parts(zip_path))
  File "/usr/lib/python2.3/site-packages/pkg_resources.py", line 836, in get_cache_path
    ensure_directory(target_path)
  File "/usr/lib/python2.3/site-packages/pkg_resources.py", line 2301, in ensure_directory
    os.makedirs(dirname)
  File "/usr/lib/python2.3/os.py", line 153, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.3/os.py", line 153, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.3/os.py", line 153, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.3/os.py", line 154, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/.python-eggs'

It seems that this is because the plugin needs the plugin cache enabled. In order to enable this I have to make changes to the apache config1.

The addition I need to make is between the
 <Location /trac>
and
 </Location>

Now I need some help on creating the custom templates as I never really understood how the templates are used when make the configs/databases.

cheers
7eis

1http://trac.edgewall.org/wiki/TracPlugins#SettingupthePluginCache

Offline Marco Hess

  • *
  • 149
  • +0/-0
    • http://www.through-ip.com
Re: Trac plugins enabling python plugin egg cache
« Reply #1 on: May 21, 2008, 07:26:06 AM »
I am not familiar with the Calendar plugin, but a couple of notes.

First of all, I would say you have a permission problem:

Quote
OSError: [Errno 13] Permission denied: '/.python-eggs'

Trac files need to be accessible by apache and need to be owned by www:www.

For the next step, what i generally do for ease of testing is that I modify the apache config directly and just restart apache to test my new configuration.

Then when the system works OK, I start thinking about how to get it into a template so it stays preserved between reconfigurations that regenerate the apache config.

Making a custom template is generally a matter of copying the existing template and copying it into the template-custom tree and making the mods.

For Trac that would be:

/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/29TracProjects

that would need to be copied to:

/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/29TracProjects

and then modified as required.

If you know what exactly you need to add to the apache config, post back and I can give you some further pointers.

Cheers,

Marco

Adelaide - Australia

Offline 7eis

  • *
  • 47
  • +0/-0
Re: Trac plugins enabling python plugin egg cache
« Reply #2 on: August 11, 2008, 06:56:12 PM »
Okay it is now working. The installation was way simpler than I thought at first.

I did the following steps and ended up with a working azcalendar  :-) some steps might not be needed :?, let me know!

1) Download the zip and extract it to a temporary directory
2) enter the directory containing the setup.py
3) issue "python setup.py bdist_egg", this will build the .egg; the .egg will be used to simplify the installation (compared to manually copying plugin for global useage). The egg is inside the folder named "dist"
4) issue "easy_install --always-unzip .egg" where .egg is the name of your freshly packed plugin
5) edit the trac.ini for the trac environments you wish to feature the plugin and add "azcalendar.azcalendar.userbasemodule = enabled" to the list of [components]
6) reconfigure you server (and reboot). Maybe a restart of Apache does it, but I wanted to be sure that no templates would overwrite the changes (and it appears they did not).

I'll check on a fresh install to simplify the process (no reconfigure/reboot/Apache restart, check if the --always-unzip is necessary and if the trac.ini is being automatically updated (i manually altered it before using this method)). When done I will add it to the wiki (possibly with a script so I can have some fun with that too), if they let me in  :P This topic can be marked as solved!

Have fun with your azcalendar! :-D
« Last Edit: August 11, 2008, 07:18:57 PM by 7eis »