]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
tools: cell-list: make python3 compatible
authorHenning Schild <henning.schild@siemens.com>
Mon, 21 Jul 2014 14:40:14 +0000 (16:40 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Tue, 22 Jul 2014 13:49:34 +0000 (15:49 +0200)
Avoid python2 only functions.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools/jailhouse-cell-list

index e1195dabf8fe69b97a6aca4ff464e17b3ad52c12..bf11295808ed7cc1f7c45ff5bec6434db8766142 100755 (executable)
@@ -16,7 +16,7 @@ import sys
 
 
 def read_cpus(path):
-    return int(file(path).read().strip().replace(",", ""), 16)
+    return int(open(path).readline().strip().replace(",", ""), 16)
 
 
 def finish_cpu_list(last_cpu, cpu):
@@ -52,8 +52,8 @@ cells = []
 for cell_path in glob.glob('/sys/devices/jailhouse/cells/*'):
     cells.append({
         'name': os.path.basename(cell_path),
-        'id': file(cell_path + "/id").read().strip(),
-        'state': file(cell_path + "/state").read().strip(),
+        'id': open(cell_path + "/id").readline().strip(),
+        'state': open(cell_path + "/state").readline().strip(),
         'cpus_assigned': read_cpus(cell_path + "/cpus_assigned"),
         'cpus_failed': read_cpus(cell_path + "/cpus_failed")
         })