summaryrefslogtreecommitdiffstats
path: root/import-layers/yocto-poky/scripts/tiny/dirsize.py
diff options
context:
space:
mode:
Diffstat (limited to 'import-layers/yocto-poky/scripts/tiny/dirsize.py')
-rwxr-xr-ximport-layers/yocto-poky/scripts/tiny/dirsize.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/import-layers/yocto-poky/scripts/tiny/dirsize.py b/import-layers/yocto-poky/scripts/tiny/dirsize.py
index 40ff4ab89..ddccc5a8c 100755
--- a/import-layers/yocto-poky/scripts/tiny/dirsize.py
+++ b/import-layers/yocto-poky/scripts/tiny/dirsize.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# Copyright (c) 2011, Intel Corporation.
# All rights reserved.
@@ -52,26 +52,22 @@ class Record:
self.size = 0
self.records = []
- def __cmp__(this, that):
+ def __lt__(this, that):
if that is None:
- return 1
+ return False
if not isinstance(that, Record):
raise TypeError
if len(this.records) > 0 and len(that.records) == 0:
- return -1
- if len(this.records) == 0 and len(that.records) > 0:
- return 1
- if this.size < that.size:
- return -1
+ return False
if this.size > that.size:
- return 1
- return 0
+ return False
+ return True
def show(self, minsize):
total = 0
if self.size <= minsize:
return 0
- print "%10d %s" % (self.size, self.path)
+ print("%10d %s" % (self.size, self.path))
for r in self.records:
total += r.show(minsize)
if len(self.records) == 0:
@@ -85,8 +81,8 @@ def main():
minsize = int(sys.argv[1])
rootfs = Record.create(".")
total = rootfs.show(minsize)
- print "Displayed %d/%d bytes (%.2f%%)" % \
- (total, rootfs.size, 100 * float(total) / rootfs.size)
+ print("Displayed %d/%d bytes (%.2f%%)" % \
+ (total, rootfs.size, 100 * float(total) / rootfs.size))
if __name__ == "__main__":
OpenPOWER on IntegriCloud