[Zope3-checkins] CVS: Zope3/utilities/fssync - sync.py:1.1.2.3

Guido van Rossum guido@python.org
Mon, 5 May 2003 11:15:45 -0400


Update of /cvs-repository/Zope3/utilities/fssync
In directory cvs.zope.org:/tmp/cvs-serv10137

Modified Files:
      Tag: fssync-branch
	sync.py 
Log Message:
Better hack to fix the search path.


=== Zope3/utilities/fssync/sync.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/utilities/fssync/sync.py:1.1.2.2	Mon May  5 11:09:56 2003
+++ Zope3/utilities/fssync/sync.py	Mon May  5 11:15:44 2003
@@ -15,7 +15,18 @@
 
 import sys, string, getopt, os, commands
 
-sys.path.append("/home/guido/projects/fssync/src") # Temp hack
+# Hack to fix the module search path
+try:
+    import zope.app
+    # All is well
+except ImportError:
+    # Fix the path, assuming this script is <root>/utilities/fssync/sync.py
+    # and the zope module is <root>/src/zope/.
+    _script = sys.argv[0]
+    _scriptdir = os.path.abspath(os.path.dirname(_script))
+    _rootdir = os.path.dirname(os.path.dirname(_scriptdir))
+    _srcdir = os.path.join(_rootdir, "src")
+    sys.path.append(_srcdir)
 
 from diff import getdiff
 from common import checkFSPath, setPrint