diff options
Diffstat (limited to 'scripts/tiny/dirsize.py')
| -rwxr-xr-x | scripts/tiny/dirsize.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/scripts/tiny/dirsize.py b/scripts/tiny/dirsize.py index 5329b86f75..0b4fbd1fa7 100755 --- a/scripts/tiny/dirsize.py +++ b/scripts/tiny/dirsize.py | |||
| @@ -52,20 +52,16 @@ class Record: | |||
| 52 | self.size = 0 | 52 | self.size = 0 |
| 53 | self.records = [] | 53 | self.records = [] |
| 54 | 54 | ||
| 55 | def __cmp__(this, that): | 55 | def __lt__(this, that): |
| 56 | if that is None: | 56 | if that is None: |
| 57 | return 1 | 57 | return False |
| 58 | if not isinstance(that, Record): | 58 | if not isinstance(that, Record): |
| 59 | raise TypeError | 59 | raise TypeError |
| 60 | if len(this.records) > 0 and len(that.records) == 0: | 60 | if len(this.records) > 0 and len(that.records) == 0: |
| 61 | return -1 | 61 | return False |
| 62 | if len(this.records) == 0 and len(that.records) > 0: | ||
| 63 | return 1 | ||
| 64 | if this.size < that.size: | ||
| 65 | return -1 | ||
| 66 | if this.size > that.size: | 62 | if this.size > that.size: |
| 67 | return 1 | 63 | return False |
| 68 | return 0 | 64 | return True |
| 69 | 65 | ||
| 70 | def show(self, minsize): | 66 | def show(self, minsize): |
| 71 | total = 0 | 67 | total = 0 |
