# HG changeset patch # User Vadim Gelfer # Date 1142406071 28800 # Node ID eff46e2c9d678cbb50ea36e6fec19c7789da948e # Parent dac4bd67f6c54659399aa5feb5bd6cbba36d9f53# Parent f92cf4a8cedd42c0257b65a27b37804592d349ee merge with crew. diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -8,7 +8,7 @@ import re from demandload import demandload from i18n import gettext as _ -demandload(globals(), "cStringIO cgi os time urllib util") +demandload(globals(), "cStringIO cgi sys os time urllib util") esctable = { '\\': '\\', @@ -235,3 +235,7 @@ def templatepath(name=None): p = os.path.join(os.path.dirname(__file__), *fl) if (name and os.path.exists(p)) or os.path.isdir(p): return os.path.normpath(p) + else: + # executable version (py2exe) doesn't support __file__ + if hasattr(sys, 'frozen'): + return os.path.join(sys.prefix, "templates") diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -789,14 +789,12 @@ def rcpath(): _rcpath = [] for p in os.environ['HGRCPATH'].split(os.pathsep): if not p: continue - try: + if os.path.isdir(p): for f in os.listdir(p): if f.endswith('.rc'): _rcpath.append(os.path.join(p, f)) - continue - except: - pass - _rcpath.append(p) + else: + _rcpath.append(p) else: _rcpath = os_rcpath() return _rcpath