summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Kacur <jkacur@redhat.com>2018-12-04 00:29:28 +0100
committerJohn Kacur <jkacur@redhat.com>2019-01-29 20:51:54 +0100
commitce1b166eb555467bb9f4c914b073aaae67f0760a (patch)
tree72f7c6839832d1b04367d86f1c39275b0ac976b7
parent306487213ee38f7d69c44c9b3d58d4feab853139 (diff)
downloadtuna-ce1b166eb555467bb9f4c914b073aaae67f0760a.tar.gz
tuna: sysfs.py: Add method to compare class cpu
In python3 you have to supply a method to compare class instances Without this you get this kind of error $ python3 sysfs.py Traceback (most recent call last): File "sysfs.py", line 97, in <module> cpus = cpus() File "sysfs.py", line 57, in __init__ self.reload() File "sysfs.py", line 92, in reload self.sockets[socket].sort() TypeError: '<' not supported between instances of 'cpu' and 'cpu' Signed-off-by: John Kacur <jkacur@redhat.com>
-rwxr-xr-xtuna/sysfs.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tuna/sysfs.py b/tuna/sysfs.py
index acc81d6..8b8a988 100755
--- a/tuna/sysfs.py
+++ b/tuna/sysfs.py
@@ -9,6 +9,9 @@ class cpu:
self.dir = "%s/%s" % (basedir, name)
self.reload()
+ def __lt__(self, other):
+ self.name < other.name
+
def readfile(self, name):
try:
f = open("%s/%s" % (self.dir, name))