Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#5757 closed defect (wontfix)

siteconfig.py is not created correctly when installing trac as an egg

Reported by: chris.arndt@… Owned by: Christopher Lenz
Priority: normal Milestone:
Component: admin/console Version: 0.10-stable
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When the trac package is installed as an egg (as it is necessary, for example, when you want to conveniently run multiple versions of trac simultaneously), the siteconfig.py file, which contains the default paths for templates, htdocs, etc. is not re-generated and consequently does not contain the right paths for the system, where it is installed.

As a consequence, initenv with trac-admin will fail when trying to copy standard wiki pages.

When installed as an egg, said directories are located under <site-packages>/trac-0.X.Y-py2.X.egg/share/trac.

A solution would be to generate the paths in the default siteconfig.py dynamically at run-time by using the pgk_resources module:

import os
import sys

try:
    from pkg_resources import Requirement, resource_filename
    try:
        prefix = resource_filename(Requirement.parse("trac"), "share/trac")
    except pkg_resources.DistributionNotFound:
        raise ImportError
except ImportError:
    prefix = os.path.join(sys.prefix, 'share', trac')

__default__conf_dir = os.path.join(prefix, 'conf')
...

A problem with this approach is that it would not work, if the trac egg is installed as a ZIP file. But this can be easiliy prevented, by setting zip_safe = False in the setup.py file.

Attachments (0)

Change History (1)

comment:1 by Noah Kantrowitz, 17 years ago

Resolution: wontfix
Status: newclosed

Trac 0.10 does not support installation as an egg. 0.11 does.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.