diff options
author | Steven Knight <knight@baldmt.com> | 2005-06-25 16:03:54 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-06-25 16:03:54 (GMT) |
commit | 01878e78547c411543d8afb3bd150d090f07447d (patch) | |
tree | cb651025caf743418b223345b1433ab32fb9bc99 /src | |
parent | c7027ef1090fc224c9b519dfb2b6928cb3a3512e (diff) | |
download | SCons-01878e78547c411543d8afb3bd150d090f07447d.zip SCons-01878e78547c411543d8afb3bd150d090f07447d.tar.gz SCons-01878e78547c411543d8afb3bd150d090f07447d.tar.bz2 |
Add a --raw option to the sconsign script.
Diffstat (limited to 'src')
-rw-r--r-- | src/CHANGES.txt | 3 | ||||
-rw-r--r-- | src/script/sconsign.py | 27 |
2 files changed, 26 insertions, 4 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6a3e259..545ef2a 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -301,6 +301,9 @@ RELEASE 0.97 - XXX whether an RCS file exists for a missing source file; whether an SCCS file exists for a missing source file. + - Add a --raw argument to the sconsign script, so it can print a + raw representation of each entry's NodeInfo dictionary. + From Wayne Lee: - Avoid "maximum recursion limit" errors when removing $(-$) pairs diff --git a/src/script/sconsign.py b/src/script/sconsign.py index 6145ad6..56152e5 100644 --- a/src/script/sconsign.py +++ b/src/script/sconsign.py @@ -201,6 +201,7 @@ Print_Entries = [] Print_Flags = Flagger() Verbose = 0 Readable = 0 +Raw = 0 def default_mapper(entry, name): try: @@ -251,9 +252,20 @@ def field(name, entry, verbose=Verbose): val = name + ": " + val return val -def nodeinfo_string(name, entry, prefix=""): +def nodeinfo_raw(name, ninfo, prefix=""): + # This does essentially what the pprint module does, + # except that it sorts the keys for deterministic output. + d = ninfo.__dict__ + keys = d.keys() + keys.sort() + l = [] + for k in keys: + l.append('%s: %s' % (repr(k), repr(d[k]))) + return name + ': {' + string.join(l, ', ') + '}' + +def nodeinfo_string(name, ninfo, prefix=""): fieldlist = ["bsig", "csig", "timestamp", "size"] - f = lambda x, e=entry, v=Verbose: field(x, e, v) + f = lambda x, ni=ninfo, v=Verbose: field(x, ni, v) outlist = [name+":"] + filter(None, map(f, fieldlist)) if Verbose: sep = "\n " + prefix @@ -262,7 +274,10 @@ def nodeinfo_string(name, entry, prefix=""): return string.join(outlist, sep) def printfield(name, entry, prefix=""): - print nodeinfo_string(name, entry.ninfo, prefix) + if Raw: + print nodeinfo_raw(name, entry.ninfo, prefix) + else: + print nodeinfo_string(name, entry.ninfo, prefix) outlist = field("implicit", entry, 0) if outlist: @@ -371,6 +386,7 @@ Options: -h, --help Print this message and exit. -i, --implicit Print implicit dependency information. -r, --readable Print timestamps in human-readable form. + --raw Print raw Python object representations. -s, --size Print file sizes human-readable form. -t, --timestamp Print timestamp information. -v, --verbose Verbose, describe each field. @@ -379,7 +395,8 @@ Options: opts, args = getopt.getopt(sys.argv[1:], "bcd:e:f:hirstv", ['bsig', 'csig', 'dir=', 'entry=', 'format=', 'help', 'implicit', - 'readable', 'size', 'timestamp', 'verbose']) + 'raw', 'readable', + 'size', 'timestamp', 'verbose']) for o, a in opts: @@ -410,6 +427,8 @@ for o, a in opts: sys.exit(0) elif o in ('-i', '--implicit'): Print_Flags['implicit'] = 1 + elif o in ('--raw',): + Raw = 1 elif o in ('-r', '--readable'): Readable = 1 elif o in ('-s', '--size'): |