Ouch ... (fix last commit)
g0dil [Mon, 7 Sep 2009 08:12:25 +0000 (08:12 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1390 270642c3-0616-0410-b53a-bc976706d245

site_scons/site_init.py

index 45eb2bb..dac80c8 100644 (file)
@@ -36,16 +36,14 @@ if os.path.dirname(os.path.dirname(os.path.abspath(SCons.__file__))) != sconseng
     if not target_top:
         target_top = '.'
     if frame:
-        cdir = frame.f_locals.get('cdir', '')
+        cdir = frame.f_locals.get('cdir', '.')
     # END HACK
     
     os.chdir(target_top)
-    for dir in reversed(os.path.normpath(cdir).split('/')):
-        if dir == '..':
-            SCons.Utio.display("scons: WARNING: failed to undo -C option")
-            break
-        if dir == '.':
-            continue
-        os.chdir('..')
+    cdir = os.path.normpath(cdir)
+    if cdir.startswith('../'):
+        SCons.Util.display("scons: WARNING: failed to undo -C option")
+    elif cdir != '.':
+        os.chdir('/'.join(('..' for _ in cdir.split('/'))))
     os.environ['SCONS_LIB_DIR'] = sconsengine
     os.execv(sconsscript, sys.argv)