Fix directory separators to allow the Debug.caller() function to strip unnecessary...
[scons.git] / src / engine / SCons / Debug.py
index cc97fe028ae57424a185d6b9720b7d10fcf7330b..1cff9c6c51b41a1b4c2fec4fc9cd4e9182ad9444 100644 (file)
@@ -31,10 +31,11 @@ needed by most users.
 
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
-
-# Recipe 14.10 from the Python Cookbook.
+import os
 import string
 import sys
+
+# Recipe 14.10 from the Python Cookbook.
 try:
     import weakref
 except ImportError:
@@ -152,6 +153,12 @@ shorten_list = [
     ( '/usr/lib/python',        0),
 ]
 
+if os.sep != '/':
+   def platformize(t):
+       return (string.replace(t[0], '/', os.sep), t[1])
+   shorten_list = map(platformize, shorten_list)
+   del platformize
+
 def func_shorten(func_tuple):
     f = func_tuple[0]
     for t in shorten_list: