diff options
author | Steven Knight <knight@baldmt.com> | 2001-09-24 13:44:50 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2001-09-24 13:44:50 (GMT) |
commit | 6d2e37c6e4552fc39dc01fd69d0e4dd8d8edf356 (patch) | |
tree | fca72d5d4a6b1435be462205524c61b4091a9d22 /src/engine/SCons/Util.py | |
parent | 21a368c1a8d22330a27381978984f1c7a33f4db6 (diff) | |
download | SCons-6d2e37c6e4552fc39dc01fd69d0e4dd8d8edf356.zip SCons-6d2e37c6e4552fc39dc01fd69d0e4dd8d8edf356.tar.gz SCons-6d2e37c6e4552fc39dc01fd69d0e4dd8d8edf356.tar.bz2 |
Implement the Depends() method.
Diffstat (limited to 'src/engine/SCons/Util.py')
-rw-r--r-- | src/engine/SCons/Util.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py new file mode 100644 index 0000000..0167260 --- /dev/null +++ b/src/engine/SCons/Util.py @@ -0,0 +1,40 @@ +"""SCons.Util + +Various utility functions go here. + +""" + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + + +import types +import string +import SCons.Node.FS + +def scons_str2nodes(arg, fs=SCons.Node.FS.default_fs): + """This function converts a string or list into a list of Node instances. + It follows the rules outlined in the SCons design document by accepting + any of the following inputs: + - A single string containing names separated by spaces. These will be + split apart at the spaces. + - A single Node instance, + - A list containingg either strings or Node instances. Any strings + in the list are not split at spaces. + In all cases, the function returns a list of Node instances.""" + + narg = arg + if type(arg) is types.StringType: + narg = string.split(arg) + elif type(arg) is not types.ListType: + narg = [arg] + + nodes = [] + for v in narg: + if type(v) is types.StringType: + nodes.append(fs.File(v)) + elif issubclass(v.__class__, SCons.Node.Node): + nodes.append(v) + else: + raise TypeError + + return nodes |