diff options
Diffstat (limited to 'scripts/tiny')
-rwxr-xr-x | scripts/tiny/dirsize.py | 6 | ||||
-rwxr-xr-x | scripts/tiny/ksize.py | 36 |
2 files changed, 21 insertions, 21 deletions
diff --git a/scripts/tiny/dirsize.py b/scripts/tiny/dirsize.py index 40ff4ab895..5329b86f75 100755 --- a/scripts/tiny/dirsize.py +++ b/scripts/tiny/dirsize.py | |||
@@ -71,7 +71,7 @@ class Record: | |||
71 | total = 0 | 71 | total = 0 |
72 | if self.size <= minsize: | 72 | if self.size <= minsize: |
73 | return 0 | 73 | return 0 |
74 | print "%10d %s" % (self.size, self.path) | 74 | print("%10d %s" % (self.size, self.path)) |
75 | for r in self.records: | 75 | for r in self.records: |
76 | total += r.show(minsize) | 76 | total += r.show(minsize) |
77 | if len(self.records) == 0: | 77 | if len(self.records) == 0: |
@@ -85,8 +85,8 @@ def main(): | |||
85 | minsize = int(sys.argv[1]) | 85 | minsize = int(sys.argv[1]) |
86 | rootfs = Record.create(".") | 86 | rootfs = Record.create(".") |
87 | total = rootfs.show(minsize) | 87 | total = rootfs.show(minsize) |
88 | print "Displayed %d/%d bytes (%.2f%%)" % \ | 88 | print("Displayed %d/%d bytes (%.2f%%)" % \ |
89 | (total, rootfs.size, 100 * float(total) / rootfs.size) | 89 | (total, rootfs.size, 100 * float(total) / rootfs.size)) |
90 | 90 | ||
91 | 91 | ||
92 | if __name__ == "__main__": | 92 | if __name__ == "__main__": |
diff --git a/scripts/tiny/ksize.py b/scripts/tiny/ksize.py index 4006f2f6f1..275c983b8d 100755 --- a/scripts/tiny/ksize.py +++ b/scripts/tiny/ksize.py | |||
@@ -33,11 +33,11 @@ from string import join | |||
33 | 33 | ||
34 | def usage(): | 34 | def usage(): |
35 | prog = os.path.basename(sys.argv[0]) | 35 | prog = os.path.basename(sys.argv[0]) |
36 | print 'Usage: %s [OPTION]...' % (prog) | 36 | print('Usage: %s [OPTION]...' % prog) |
37 | print ' -d, display an additional level of drivers detail' | 37 | print(' -d, display an additional level of drivers detail') |
38 | print ' -h, --help display this help and exit' | 38 | print(' -h, --help display this help and exit') |
39 | print '' | 39 | print('') |
40 | print 'Run %s from the top-level Linux kernel build directory.' % (prog) | 40 | print('Run %s from the top-level Linux kernel build directory.' % prog) |
41 | 41 | ||
42 | 42 | ||
43 | class Sizes: | 43 | class Sizes: |
@@ -55,8 +55,8 @@ class Sizes: | |||
55 | self.text = self.data = self.bss = self.total = 0 | 55 | self.text = self.data = self.bss = self.total = 0 |
56 | 56 | ||
57 | def show(self, indent=""): | 57 | def show(self, indent=""): |
58 | print "%-32s %10d | %10d %10d %10d" % \ | 58 | print("%-32s %10d | %10d %10d %10d" % \ |
59 | (indent+self.title, self.total, self.text, self.data, self.bss) | 59 | (indent+self.title, self.total, self.text, self.data, self.bss)) |
60 | 60 | ||
61 | 61 | ||
62 | class Report: | 62 | class Report: |
@@ -101,22 +101,22 @@ class Report: | |||
101 | 101 | ||
102 | def show(self, indent=""): | 102 | def show(self, indent=""): |
103 | rule = str.ljust(indent, 80, '-') | 103 | rule = str.ljust(indent, 80, '-') |
104 | print "%-32s %10s | %10s %10s %10s" % \ | 104 | print("%-32s %10s | %10s %10s %10s" % \ |
105 | (indent+self.title, "total", "text", "data", "bss") | 105 | (indent+self.title, "total", "text", "data", "bss")) |
106 | print rule | 106 | print(rule) |
107 | self.sizes.show(indent) | 107 | self.sizes.show(indent) |
108 | print rule | 108 | print(rule) |
109 | for p in self.parts: | 109 | for p in self.parts: |
110 | if p.sizes.total > 0: | 110 | if p.sizes.total > 0: |
111 | p.sizes.show(indent) | 111 | p.sizes.show(indent) |
112 | print rule | 112 | print(rule) |
113 | print "%-32s %10d | %10d %10d %10d" % \ | 113 | print("%-32s %10d | %10d %10d %10d" % \ |
114 | (indent+"sum", self.totals["total"], self.totals["text"], | 114 | (indent+"sum", self.totals["total"], self.totals["text"], |
115 | self.totals["data"], self.totals["bss"]) | 115 | self.totals["data"], self.totals["bss"])) |
116 | print "%-32s %10d | %10d %10d %10d" % \ | 116 | print("%-32s %10d | %10d %10d %10d" % \ |
117 | (indent+"delta", self.deltas["total"], self.deltas["text"], | 117 | (indent+"delta", self.deltas["total"], self.deltas["text"], |
118 | self.deltas["data"], self.deltas["bss"]) | 118 | self.deltas["data"], self.deltas["bss"])) |
119 | print "\n" | 119 | print("\n") |
120 | 120 | ||
121 | def __cmp__(this, that): | 121 | def __cmp__(this, that): |
122 | if that is None: | 122 | if that is None: |
@@ -134,7 +134,7 @@ def main(): | |||
134 | try: | 134 | try: |
135 | opts, args = getopt.getopt(sys.argv[1:], "dh", ["help"]) | 135 | opts, args = getopt.getopt(sys.argv[1:], "dh", ["help"]) |
136 | except getopt.GetoptError, err: | 136 | except getopt.GetoptError, err: |
137 | print '%s' % str(err) | 137 | print('%s' % str(err)) |
138 | usage() | 138 | usage() |
139 | sys.exit(2) | 139 | sys.exit(2) |
140 | 140 | ||