diff options
Diffstat (limited to 'src/engine/SCons/Util.py')
-rw-r--r-- | src/engine/SCons/Util.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index a5ea859..22aca08 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -951,6 +951,23 @@ class Unbuffered: def __getattr__(self, attr): return getattr(self.file, attr) +def make_path_relative(path): + """ makes an absolute path name to a relative pathname. + """ + if os.path.isabs(path): + drive_s,path = os.path.splitdrive(path) + + import re + if not drive_s: + path=re.compile("/*(.*)").findall(path)[0] + else: + path=path[1:] + + assert( not os.path.isabs( path ) ), path + return path + + + # The original idea for AddMethod() and RenameFunction() come from the # following post to the ActiveState Python Cookbook: # @@ -1025,4 +1042,6 @@ def RenameFunction(function, name): name, func_defaults) + + del __revision__ |