hgtk: find hggtk via relative path
authorTK Soh <teekaysoh@yahoo.com>
Sat, 26 Apr 2008 08:26:54 +0100
changeset 1146 4c5a64b79885
parent 1145 f348320e097e
child 1147 e2b03522d571
hgtk: find hggtk via relative path
contrib/hgtk
--- a/contrib/hgtk	Sat Apr 26 07:54:46 2008 +0100
+++ b/contrib/hgtk	Sat Apr 26 08:26:54 2008 +0100
@@ -47,6 +47,15 @@
         if norm not in sys.path:
             sys.path.append(norm)
 
+        try:
+            # assuming TortoiseHg source layout, with hgtk in contrib
+            path = os.path.dirname(os.path.abspath(__file__))
+            norm = os.path.normpath(os.path.join(path, '..'))
+            if norm not in sys.path:
+                sys.path.append(norm)
+        except NameError: # __file__ is not always available
+            pass
+
     try:
         from hggtk import hglib
     except ImportError: