comparison mercurial/templater.py @ 1955:2f500a4b6e99

Fix the py2exe template path problem (issue:152) again. This patch is same with 1834:24881eaebee3 which is leaved behind by 1897:58b6784cf9f1.
author Shun-ichi GOTO <shunichi.goto@gmail.com>
date Wed, 15 Mar 2006 06:39:04 +0100
parents a5bf0030df5f
children 778281d46bb2
comparison
equal deleted inserted replaced
1920:b7cc0f323a4c 1955:2f500a4b6e99
6 # of the GNU General Public License, incorporated herein by reference. 6 # of the GNU General Public License, incorporated herein by reference.
7 7
8 import re 8 import re
9 from demandload import demandload 9 from demandload import demandload
10 from i18n import gettext as _ 10 from i18n import gettext as _
11 demandload(globals(), "cStringIO cgi os time urllib util") 11 demandload(globals(), "cStringIO cgi sys os time urllib util")
12 12
13 esctable = { 13 esctable = {
14 '\\': '\\', 14 '\\': '\\',
15 'r': '\r', 15 'r': '\r',
16 't': '\t', 16 't': '\t',
233 fl = f.split('/') 233 fl = f.split('/')
234 if name: fl.append(name) 234 if name: fl.append(name)
235 p = os.path.join(os.path.dirname(__file__), *fl) 235 p = os.path.join(os.path.dirname(__file__), *fl)
236 if (name and os.path.exists(p)) or os.path.isdir(p): 236 if (name and os.path.exists(p)) or os.path.isdir(p):
237 return os.path.normpath(p) 237 return os.path.normpath(p)
238 else:
239 # executable version (py2exe) doesn't support __file__
240 if hasattr(sys, 'frozen'):
241 return os.path.join(sys.prefix, "templates")