Package wafadmin :: Module Utils
[hide private]
[frames] | no frames]

Module Utils

source code


Utilities, the stable ones are the following:

* h_file: compute a unique value for a file (hash), it uses
  the module fnv if it is installed (see waf/utils/fnv & http://code.google.com/p/waf/wiki/FAQ)
  else, md5 (see the python docs)

  For large projects (projects with more than 15000 files) it is possible to use
  a hashing based on the path and the size (may give broken cache results)

        import stat
        def h_file(filename):
                st = os.stat(filename)
                if stat.S_ISDIR(st[stat.ST_MODE]): raise IOError, 'not a file'
                m = md5()
                m.update(str(st.st_mtime))
                m.update(str(st.st_size))
                m.update(filename)
                return m.digest()

    To replace the function in your project, use something like this:
        import Utils
        Utils.h_file = h_file

* h_list
* h_fun
* get_term_cols
* ordered_dict

Classes [hide private]
  WafError
  WscriptError
  ordered_dict
Functions [hide private]
 
h_file(filename) source code
 
listdir_win32(s) source code
 
listdir(s) source code
 
waf_version(mini=0x010000, maxi=0x100000)
Halts if the waf version is wrong
source code
 
python_24_guard() source code
 
to_list(sth) source code
 
load_module(file_path, name=WSCRIPT_FILE)
this function requires an absolute path
source code
 
set_main_module(file_path)
Load custom options, if defined
source code
 
to_hashtable(s)
used for importing env files
source code
 
myfun() source code
 
get_term_cols() source code
 
split_path(path) source code
 
__split_dirs(path) source code
 
copy_attrs(orig, dest, names, only_if_set=False) source code
 
quote_define_name(path)
Converts a string to a constant name, foo/zbr-xpto.h -> FOO_ZBR_XPTO_H
source code
 
quote_whitespace(path) source code
 
trimquotes(s) source code
 
h_list(lst) source code
 
h_fun(fun) source code
 
hash_function_with_globals(prevhash, func)
hash a function (object) and the global vars needed from outside ignore unhashable global variables (lists)
source code
 
pprint(col, str, label='')
print messages in color
source code
 
check_dir(dir)
If a folder doesn't exists, create it.
source code
 
cmd_output(cmd, e=None) source code
 
subst_vars(expr, params)
substitute ${PREFIX}/bin in /usr/local/bin
source code
Variables [hide private]
  indicator = sys.platform== 'win32' and '\x1b[A\x1b[K%s%s%s\r' ...
  g_loaded_modules = {}
index modules by absolute path
  g_module = None
the main module is special
  rot_idx = 0
  rot_chr = ['\\', '|', '/', '-']
the rotation thing
  _quote_define_name_translation = None
lazily construct a translation table for mapping invalid characters to valid ones
  _hash_blacklist_types = types.BuiltinFunctionType, types.Modul...
  reg_subst = re.compile(r"(\\\\)|(\\\$)|\$\{([^}]+)\}")
Function Details [hide private]

hash_function_with_globals(prevhash, func)

source code 

hash a function (object) and the global vars needed from outside ignore unhashable global variables (lists)

prevhash: previous hash value to be combined with this one; if there is no previous value, zero should be used here

func: a Python function object.


Variables Details [hide private]

indicator

Value:
sys.platform== 'win32' and '\x1b[A\x1b[K%s%s%s\r' or '\x1b[K%s%s%s\r'

_hash_blacklist_types

Value:
types.BuiltinFunctionType, types.ModuleType, types.FunctionType, types\
.ClassType, types.TypeType, types.NoneType,