merge with crew.
authorVadim Gelfer <vadim.gelfer@gmail.com>
Tue, 14 Mar 2006 23:01:11 -0800
changeset 1961 eff46e2c9d67
parent 1960 dac4bd67f6c5 (current diff)
parent 1958 f92cf4a8cedd (diff)
child 1962 2a676ad52c22
merge with crew.
--- 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")
--- 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