diff options
author | Steven Knight <knight@baldmt.com> | 2003-04-23 22:27:58 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-04-23 22:27:58 (GMT) |
commit | 9587e1d2dad1c532d86f664f5cbd6266ebd77808 (patch) | |
tree | 71ab8dbc059c0d16de3f5088427e288716d9dd43 /src/engine/SCons/Util.py | |
parent | 9c4ebd90350becd6ff9b1b4e4049546680c849b6 (diff) | |
download | SCons-9587e1d2dad1c532d86f664f5cbd6266ebd77808.zip SCons-9587e1d2dad1c532d86f664f5cbd6266ebd77808.tar.gz SCons-9587e1d2dad1c532d86f664f5cbd6266ebd77808.tar.bz2 |
Add support for MIDL. (Greg Spencer)
Diffstat (limited to 'src/engine/SCons/Util.py')
-rw-r--r-- | src/engine/SCons/Util.py | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 3a9d3b7..a570a71 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -40,6 +40,7 @@ import sys import types import UserDict import UserList +import SCons.Node try: from UserString import UserString @@ -166,6 +167,31 @@ class PathList(UserList.UserList): # available even if this object is a Lister, not a PathList. return PathList(map(lambda x: updrive(os.path.abspath(x)), self.data)) + def __getSrcDir(self): + """Return the directory containing the linked + source file, or this file path, if not linked""" + sp = self.__splitPath()[0] + rv = [] + for dir in sp: + dn = SCons.Node.FS.default_fs.Dir(str(dir)) + if (dn == None): + rv = rv + [''] + else: + rv = rv + [str(dn.srcnode())] + return PathList(rv) + + def __getSrcPath(self): + """Return the path to the linked source file, + or this file path, if not linked""" + rv = [] + for dir in self.data: + fn = SCons.Node.FS.default_fs.File(str(dir)) + if (fn == None): + rv = rv + [''] + else: + rv = rv + [str(fn.srcnode())] + return PathList(rv) + def __posix(self): if os.sep == '/': return self @@ -178,11 +204,14 @@ class PathList(UserList.UserList): "dir" : __getDir, "suffix" : __getSuffix, "abspath" : __getAbsPath, - "posix" : __posix} + "srcpath" : __getSrcPath, + "srcdir" : __getSrcDir, + "posix" : __posix + } def is_literal(self): return 1 - + def __str__(self): return string.join(self.data) |