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(a)redhat.com>
---
tuna/sysfs.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tuna/sysfs.py b/tuna/sysfs.py
index acc81d667753..8b8a988659ce 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))
--
2.19.2