From: g0dil Date: Mon, 7 Sep 2009 08:08:20 +0000 (+0000) Subject: Add 'scons -C' support to scons version switching hack X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=4723b149c5ca163fab7fce58a5314c5db212bedc;p=senf.git Add 'scons -C' support to scons version switching hack git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1389 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/site_scons/site_init.py b/site_scons/site_init.py index 07ffa25..45eb2bb 100644 --- a/site_scons/site_init.py +++ b/site_scons/site_init.py @@ -29,14 +29,23 @@ if os.path.dirname(os.path.dirname(os.path.abspath(SCons.__file__))) != sconseng frame = sys._getframe() target_top = marker = [] while frame and target_top is marker: - target_top = frame.f_locals.get('target_top',marker) frame = frame.f_back + if frame : target_top = frame.f_locals.get('target_top',marker) if target_top is marker: SCons.Util.display("scons: WARNING: scons -u will probably fail") if not target_top: target_top = '.' + if frame: + 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('..') os.environ['SCONS_LIB_DIR'] = sconsengine os.execv(sconsscript, sys.argv)