Browse Source

[trac1010] that log __init__ needed a bit more smartness

Jelte Jansen 14 years ago
parent
commit
f78cf6ebc2
1 changed files with 10 additions and 2 deletions
  1. 10 2
      src/lib/python/isc/log/__init__.py

+ 10 - 2
src/lib/python/isc/log/__init__.py

@@ -23,7 +23,15 @@
 # Should we look there? Or define something in bind10_config?
 # Should we look there? Or define something in bind10_config?
 
 
 import os
 import os
+import sys
+
 cwd = os.getcwd()
 cwd = os.getcwd()
-pos = cwd.rfind('/src/')
-import sys; sys.path.insert(0, cwd[:pos] + '/src/lib/python/isc/log/.libs')
+base = os.path.split(cwd)[0]
+# find the path that contains src/lib/python/isc/log/.libs and append it
+while base != cwd:
+    loglibdir = os.path.join(base, 'src/lib/python/isc/log/.libs')
+    if os.path.exists(loglibdir):
+        sys.path.append(loglibdir)
+    cwd = base
+    base = os.path.split(cwd)[0]
 from log import *
 from log import *