Mercurial > hg
comparison mercurial/hgweb.py @ 1834:24881eaebee3
Fixes running 'hg serve' with Windows executable and no explicit template path configured.
PY2EXE executables don't support __file__ but do place the directory of the
shared code library into sys.prefix.
Fixes bug 152.
author | Lee Cantey <lcantey@gmail.com> |
---|---|
date | Fri, 03 Mar 2006 13:41:12 -0800 |
parents | 4ced57680ce7 |
children | 7a09785d3237 |
comparison
equal
deleted
inserted
replaced
1833:fc959d6ffb13 | 1834:24881eaebee3 |
---|---|
18 def templatepath(): | 18 def templatepath(): |
19 for f in "templates", "../templates": | 19 for f in "templates", "../templates": |
20 p = os.path.join(os.path.dirname(__file__), f) | 20 p = os.path.join(os.path.dirname(__file__), f) |
21 if os.path.isdir(p): | 21 if os.path.isdir(p): |
22 return os.path.normpath(p) | 22 return os.path.normpath(p) |
23 else: | |
24 # executable version (py2exe) doesn't support __file__ | |
25 if hasattr(sys, 'frozen'): | |
26 return os.path.join(sys.prefix, "templates") | |
23 | 27 |
24 def age(x): | 28 def age(x): |
25 def plural(t, c): | 29 def plural(t, c): |
26 if c == 1: | 30 if c == 1: |
27 return t | 31 return t |