Skip to content

Commit 64cc40b

Browse files
author
Justus Pendleton
committed
Marek Kubica's patch to find templates installed by easy_install
Adds one more place to look for templates. We already look in several places, trying to find them. This adds one more. When you install via easy_install the hierarchy ends up looking like: /usr/lib/python2.5/site-packages/roundup-1.3.3-py2.5.egg/roundup/admin.py /usr/lib/python2.5/site-packages/roundup-1.3.3-py2.5.egg/share/roundup/templates/*
1 parent 67af082 commit 64cc40b

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

roundup/admin.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: admin.py,v 1.107 2007-09-07 20:18:15 jpend Exp $
19+
# $Id: admin.py,v 1.108 2007-09-11 04:12:17 jpend Exp $
2020

2121
'''Administration commands for maintaining Roundup trackers.
2222
'''
@@ -287,26 +287,31 @@ def listTemplates(self):
287287
288288
Look in the following places, where the later rules take precedence:
289289
290-
1. <prefix>/share/roundup/templates/*
290+
1. <roundup.admin.__file__>/../../share/roundup/templates/*
291+
this is where they will be if we installed an egg via easy_install
292+
2. <prefix>/share/roundup/templates/*
291293
this should be the standard place to find them when Roundup is
292294
installed
293-
2. <roundup.admin.__file__>/../templates/*
295+
3. <roundup.admin.__file__>/../templates/*
294296
this will be used if Roundup's run in the distro (aka. source)
295297
directory
296-
3. <current working dir>/*
298+
4. <current working dir>/*
297299
this is for when someone unpacks a 3rd-party template
298-
4. <current working dir>
300+
5. <current working dir>
299301
this is for someone who "cd"s to the 3rd-party template dir
300302
'''
301303
# OK, try <prefix>/share/roundup/templates
304+
# and <egg-directory>/share/roundup/templates
302305
# -- this module (roundup.admin) will be installed in something
303306
# like:
304-
# /usr/lib/python2.2/site-packages/roundup/admin.py (5 dirs up)
305-
# c:\python22\lib\site-packages\roundup\admin.py (4 dirs up)
306-
# we're interested in where the "lib" directory is - ie. the /usr/
307-
# part
307+
# /usr/lib/python2.5/site-packages/roundup/admin.py (5 dirs up)
308+
# c:\python25\lib\site-packages\roundup\admin.py (4 dirs up)
309+
# /usr/lib/python2.5/site-packages/roundup-1.3.3-py2.5-egg/roundup/admin.py
310+
# (2 dirs up)
311+
#
312+
# we're interested in where the directory containing "share" is
308313
templates = {}
309-
for N in 4, 5:
314+
for N in 2, 4, 5:
310315
path = __file__
311316
# move up N elements in the path
312317
for i in range(N):

0 commit comments

Comments
 (0)