| Home | Trees | Index | Help |
|
|---|
| Package SCons :: Module Util |
|
SCons.Util Various utility functions go here.
| Classes | |
|---|---|
CallableComposite |
A simple composite callable class that, when called, will invoke all of its contained callables with the same arguments. |
CLVar |
A class for command-line construction variables. |
DisplayEngine |
|
LogicalLines |
|
NodeList |
This class is almost exactly like a regular list of Nodes (actually it can hold any object), with one important difference. |
Null |
Null objects always and reliably "do nothging." |
OrderedDict |
|
Proxy |
A simple generic Proxy class, forwarding all calls to subject. |
Selector |
A callable ordered dictionary that maps file suffixes to dictionary values. |
Unbuffered |
A proxy class that wraps a file object, flushing after every write, and delegating everything else to the wrapped object. |
UniqueList |
|
| Function Summary | |
|---|---|
Adds either a bound method to an instance or an unbound method to a class. | |
adjustixes(fname,
pre,
suf,
ensure_suffix)
| |
This appends new path elements to the given old path. | |
case_sensitive_suffixes(s1,
s2)
| |
Check whether sequence str contains ALL of the items in set. | |
Check whether sequence str contains ANY of the items in set. | |
Check whether sequence str contains ONLY items in set. | |
dictify(keys,
values,
result)
| |
flatten(sequence,
scalarp,
result)
| |
Given a string, first determine if it looks like a reference to a single environment variable, like "$FOO" or "${FOO}". | |
Transforms an absolute path into a native path for the system. | |
IDX(N)
| |
is_Dict(obj)
| |
is_List(obj)
| |
is_Scalar(e)
| |
is_Sequence(obj)
| |
is_String(obj)
| |
is_Tuple(obj)
| |
Return if the specified string is a legitimate construction variable. | |
makes an absolute path name to a relative pathname. | |
Collects a list of signatures into an aggregate signature. | |
MD5signature(s)
| |
This prepends newpath elements to the given oldpath. | |
Print a tree of nodes. | |
Returns a function identical to the specified function, but with the specified name. | |
Render a tree of nodes into an ASCII tree view. | |
semi_deepcopy(x)
| |
Split(arg)
| |
Same as os.path.splitext() but faster. | |
to_String(s)
| |
to_String_for_signature(obj)
| |
Return a list of the elements in s, but without duplicates. | |
uniquer(seq,
idfun)
| |
uniquer_hashables(seq)
| |
Make the drive letter (if any) upper case. | |
WhereIs(file,
path,
pathext,
reject)
| |
| Function Details |
|---|
AddMethod(object, function, name=None)
Adds either a bound method to an instance or an unbound method to
a class. If name is ommited the name of the specified function
is used by default.
Example:
a = A()
def f(self, x, y):
self.z = x + y
AddMethod(f, A, "add")
a.add(2, 4)
print a.z
AddMethod(lambda self, i: self.l[i], a, "listIndex")
print a.listIndex(5)
|
AppendPath(oldpath, newpath, sep=':')This appends new path elements to the given old path. Will only add any particular path once (leaving the last one it encounters and ignoring the rest, to preserve path order), and will os.path.normpath and os.path.normcase all paths to help assure this. This can also handle the case where the given old path variable is a list instead of a string, in which case a list will be returned instead of a string.
|
containsAll(str, set)Check whether sequence str contains ALL of the items in set. |
containsAny(str, set)Check whether sequence str contains ANY of the items in set. |
containsOnly(str, set)Check whether sequence str contains ONLY items in set. |
get_environment_var(varstr)Given a string, first determine if it looks like a reference to a single environment variable, like "$FOO" or "${FOO}". If so, return that variable with no decorations ("FOO"). If not, return None. |
get_native_path(path)Transforms an absolute path into a native path for the system. Non-Cygwin version, just leave the path alone. |
is_valid_construction_var(varstr)Return if the specified string is a legitimate construction variable. |
make_path_relative(path)makes an absolute path name to a relative pathname. |
MD5collect(signatures)Collects a list of signatures into an aggregate signature. signatures - a list of signatures returns - the aggregate signature |
PrependPath(oldpath, newpath, sep=':')This prepends newpath elements to the given oldpath. Will only add any particular path once (leaving the first one it encounters and ignoring the rest, to preserve path order), and will os.path.normpath and os.path.normcase all paths to help assure this. This can also handle the case where the given old path variable is a list instead of a string, in which case a list will be returned instead of a string.
|
print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited={})Print a tree of nodes. This is like render_tree, except it prints lines directly instead of creating a string representation in memory, so that huge trees can be printed. root - the root node of the tree child_func - the function called to get the children of a node prune - don't visit the same node twice showtags - print status information to the left of each node line margin - the format of the left margin to use for children of root. 1 results in a pipe, and 0 results in no pipe. visited - a dictionary of visited nodes in the current branch if not prune, or in the whole tree if prune. |
RenameFunction(function, name)Returns a function identical to the specified function, but with the specified name. |
render_tree(root, child_func, prune=0, margin=[0], visited={})Render a tree of nodes into an ASCII tree view. root - the root node of the tree child_func - the function called to get the children of a node prune - don't visit the same node twice margin - the format of the left margin to use for children of root. 1 results in a pipe, and 0 results in no pipe. visited - a dictionary of visited nodes in the current branch if not prune, or in the whole tree if prune. |
splitext(path)Same as os.path.splitext() but faster. |
unique(s)Return a list of the elements in s, but without duplicates. For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3], unique("abcabc") some permutation of ["a", "b", "c"], and unique(([1, 2], [2, 3], [1, 2])) some permutation of [[2, 3], [1, 2]]. For best speed, all sequence elements should be hashable. Then unique() will usually work in linear time. If not possible, the sequence elements should enjoy a total ordering, and if list(s).sort() doesn't raise TypeError it's assumed that they do enjoy a total ordering. Then unique() will usually work in O(N*log2(N)) time. If that's not possible either, the sequence elements must support equality-testing. Then unique() will usually work in quadratic time. |
updrive(path)Make the drive letter (if any) upper case. This is useful because Windows is inconsitent on the case of the drive letter, which can cause inconsistencies when calculating command signatures. |
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Wed Dec 12 09:39:32 2007 | http://epydoc.sf.net |