[Zconfig] SVN: ZConfig/trunk/scripts/zconfig Included "../lib/python" in the search path for modules

Yoshito Komatsu ykomatsu at akaumigame.org
Wed Jan 4 10:17:00 EST 2006


Log message for revision 41132:
  Included "../lib/python" in the search path for modules
  so that the scripts can find modules when Zope 3 is installed
  not in the standard path.
  

Changed:
  U   ZConfig/trunk/scripts/zconfig
  U   ZConfig/trunk/scripts/zconfig_schema2html

-=-
Modified: ZConfig/trunk/scripts/zconfig
===================================================================
--- ZConfig/trunk/scripts/zconfig	2006-01-04 14:52:50 UTC (rev 41131)
+++ ZConfig/trunk/scripts/zconfig	2006-01-04 15:16:59 UTC (rev 41132)
@@ -38,7 +38,18 @@
 
 import optparse
 import sys
+import os
 
+if __name__ == "__main__":
+    here = os.path.dirname(os.path.realpath(__file__))
+    swhome = os.path.dirname(here)
+    for parts in [("src",), ("lib", "python"), ("Lib", "site-packages")]:
+        d = os.path.join(swhome, *(parts + ("ZConfig",)))
+        if os.path.isdir(d):
+            d = os.path.join(swhome, *parts)
+            sys.path.insert(0, d)
+            break
+
 import ZConfig
 
 

Modified: ZConfig/trunk/scripts/zconfig_schema2html
===================================================================
--- ZConfig/trunk/scripts/zconfig_schema2html	2006-01-04 14:52:50 UTC (rev 41131)
+++ ZConfig/trunk/scripts/zconfig_schema2html	2006-01-04 15:16:59 UTC (rev 41132)
@@ -15,9 +15,22 @@
 
 __version__ = '$Revision: 1.3 $'[11:-2]
 
+import sys
+import os
+import cgi
+
+if __name__ == "__main__":
+    here = os.path.dirname(os.path.realpath(__file__))
+    swhome = os.path.dirname(here)
+    for parts in [("src",), ("lib", "python"), ("Lib", "site-packages")]:
+        d = os.path.join(swhome, *(parts + ("ZConfig",)))
+        if os.path.isdir(d):
+            d = os.path.join(swhome, *parts)
+            sys.path.insert(0, d)
+            break
+
 import ZConfig.loader
 from ZConfig.info import *
-import sys, cgi
 
 def esc(x): return cgi.escape(str(x))
 def dt(x):



More information about the ZConfig mailing list