Mercurial > cpython-lru_cache-weakref
diff Tools/scripts/objgraph.py @ 42427:46625e6122e9
Convert print statements to function calls in Tools/.
| author | Collin Winter <collinw@gmail.com> |
|---|---|
| date | Fri, 03 Aug 2007 17:06:41 +0000 |
| parents | f731859e9b3b |
| children | 893a4dc17a91 |
line wrap: on
line diff
--- a/Tools/scripts/objgraph.py Fri Aug 03 13:45:24 2007 +0000 +++ b/Tools/scripts/objgraph.py Fri Aug 03 17:06:41 2007 +0000 @@ -80,7 +80,7 @@ store(file2undef, fn, name) store(undef2file, name, fn) elif not type in ignore: - print fn + ':' + name + ': unknown type ' + type + print(fn + ':' + name + ': unknown type ' + type) # Print all names that were undefined in some module and where they are # defined. @@ -89,7 +89,7 @@ flist = file2undef.keys() flist.sort() for filename in flist: - print filename + ':' + print(filename + ':') elist = file2undef[filename] elist.sort() for ext in elist: @@ -98,9 +98,9 @@ else: tabs = '\t\t' if not def2file.has_key(ext): - print '\t' + ext + tabs + ' *undefined' + print('\t' + ext + tabs + ' *undefined') else: - print '\t' + ext + tabs + flat(def2file[ext]) + print('\t' + ext + tabs + flat(def2file[ext])) # Print for each module the names of the other modules that use it. # @@ -114,14 +114,14 @@ callers = callers + undef2file[label] if callers: callers.sort() - print filename + ':' + print(filename + ':') lastfn = '' for fn in callers: if fn <> lastfn: - print '\t' + fn + print('\t' + fn) lastfn = fn else: - print filename + ': unused' + print(filename + ': unused') # Print undefined names and where they are used. # @@ -134,11 +134,11 @@ elist = undefs.keys() elist.sort() for ext in elist: - print ext + ':' + print(ext + ':') flist = undefs[ext] flist.sort() for filename in flist: - print '\t' + filename + print('\t' + filename) # Print warning messages about names defined in more than one file. # @@ -149,8 +149,8 @@ names.sort() for name in names: if len(def2file[name]) > 1: - print 'warning:', name, 'multiply defined:', - print flat(def2file[name]) + print('warning:', name, 'multiply defined:', end=' ') + print(flat(def2file[name])) sys.stdout = savestdout # Main program @@ -160,14 +160,14 @@ optlist, args = getopt.getopt(sys.argv[1:], 'cdu') except getopt.error: sys.stdout = sys.stderr - print 'Usage:', os.path.basename(sys.argv[0]), - print '[-cdu] [file] ...' - print '-c: print callers per objectfile' - print '-d: print callees per objectfile' - print '-u: print usage of undefined symbols' - print 'If none of -cdu is specified, all are assumed.' - print 'Use "nm -o" to generate the input (on IRIX: "nm -Bo"),' - print 'e.g.: nm -o /lib/libc.a | objgraph' + print('Usage:', os.path.basename(sys.argv[0]), end=' ') + print('[-cdu] [file] ...') + print('-c: print callers per objectfile') + print('-d: print callees per objectfile') + print('-u: print usage of undefined symbols') + print('If none of -cdu is specified, all are assumed.') + print('Use "nm -o" to generate the input (on IRIX: "nm -Bo"),') + print('e.g.: nm -o /lib/libc.a | objgraph') return 1 optu = optc = optd = 0 for opt, void in optlist: @@ -192,15 +192,15 @@ more = (optu + optc + optd > 1) if optd: if more: - print '---------------All callees------------------' + print('---------------All callees------------------') printcallee() if optu: if more: - print '---------------Undefined callees------------' + print('---------------Undefined callees------------') printundef() if optc: if more: - print '---------------All Callers------------------' + print('---------------All Callers------------------') printcaller() return 0
