Skip to content

Commit 6186740

Browse files
author
Ralf Schlatterbeck
committed
Directory structure changes.
- Implement common directory for imports <tracker_home>/lib - put directory currently being scanned for modules onto the module path -- add "extension" directory when scanning extension, and detectors when scanning detectors. See also thread discussing these modifications at http://comments.gmane.org/gmane.comp.bug-tracking.roundup.devel/4450 Note that I currently *do not* remove the lib directory from sys.path
1 parent 8c6f1ad commit 6186740

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

roundup/instance.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: instance.py,v 1.33 2004-11-29 02:55:46 richard Exp $
18+
# $Id: instance.py,v 1.34 2006-12-01 09:48:56 schlatterbeck Exp $
1919

2020
'''Tracker handling (open tracker).
2121
@@ -24,6 +24,7 @@
2424
__docformat__ = 'restructuredtext'
2525

2626
import os
27+
import sys
2728
from roundup import configuration, mailgw
2829
from roundup import hyperdb, backends
2930
from roundup.cgi import client, templating
@@ -46,6 +47,9 @@ def __init__(self, tracker_home, optimize=0):
4647
self.tracker_home = tracker_home
4748
self.optimize = optimize
4849
self.config = configuration.CoreConfig(tracker_home)
50+
libdir = os.path.join(tracker_home, 'lib')
51+
if os.path.isdir(libdir):
52+
sys.path.insert(1, libdir)
4953
self.cgi_actions = {}
5054
self.templating_utils = {}
5155
self.load_interfaces()
@@ -142,12 +146,14 @@ def get_extensions(self, dirname):
142146
extensions = []
143147
dirpath = os.path.join(self.tracker_home, dirname)
144148
if os.path.isdir(dirpath):
149+
sys.path.insert(1, dirpath)
145150
for name in os.listdir(dirpath):
146151
if not name.endswith('.py'):
147152
continue
148153
vars = {}
149154
self._load_python(os.path.join(dirname, name), vars)
150155
extensions.append(vars['init'])
156+
del sys.path[1]
151157
return extensions
152158

153159
def init(self, adminpw):

0 commit comments

Comments
 (0)