We are now calling python3 via shebang, so no need to care about python2 anymore.
Signed-off-by: Florian Bezdeka <[email protected]> --- pyjailhouse/config_parser.py | 1 - pyjailhouse/extendedenum.py | 15 +-------------- pyjailhouse/sysfs_parser.py | 7 ++----- scripts/arm64-parsedump.py | 1 - tools/jailhouse-cell-linux | 1 - tools/jailhouse-cell-stats | 1 - tools/jailhouse-config-check | 1 - tools/jailhouse-config-create | 1 - tools/jailhouse-hardware-check | 5 ----- 9 files changed, 3 insertions(+), 30 deletions(-) diff --git a/pyjailhouse/config_parser.py b/pyjailhouse/config_parser.py index cad761a5..7a7f48a3 100644 --- a/pyjailhouse/config_parser.py +++ b/pyjailhouse/config_parser.py @@ -14,7 +14,6 @@ # information about the system. For more advanced scenarios you will have # to change the generated C-code. -from __future__ import print_function import struct from .extendedenum import ExtendedEnum diff --git a/pyjailhouse/extendedenum.py b/pyjailhouse/extendedenum.py index f3dd1bb9..bcb959bd 100644 --- a/pyjailhouse/extendedenum.py +++ b/pyjailhouse/extendedenum.py @@ -9,25 +9,12 @@ # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. -# Python 2 and 3 have different ways of handling metaclasses. This decorator -# is a support layer for both and can be removed once Python 2 is no longer -# supported. -def with_metaclass(meta): - def decorator(cls): - body = vars(cls).copy() - body.pop('__dict__', None) - body.pop('__weakref__', None) - return meta(cls.__name__, cls.__bases__, body) - return decorator - - class ExtendedEnumMeta(type): def __getattr__(cls, key): return cls(cls._ids[key]) -@with_metaclass(ExtendedEnumMeta) -class ExtendedEnum: +class ExtendedEnum(metaclass=ExtendedEnumMeta): def __init__(self, value): self.value = value diff --git a/pyjailhouse/sysfs_parser.py b/pyjailhouse/sysfs_parser.py index 58910e8d..7f19fb57 100644 --- a/pyjailhouse/sysfs_parser.py +++ b/pyjailhouse/sysfs_parser.py @@ -919,14 +919,11 @@ class IORegion(object): def start_str(self): # This method is used in root-cell-config.c.tmpl - - # Python 2 appends a 'L' to hexadecimal format of large integers, - # therefore .strip('L') is necessary. - return hex(self.start).strip('L') + return hex(self.start) def size_str(self): # Comments from start_str() apply here as well. - return hex(self.size()).strip('L') + return hex(self.size()) class MemRegion(IORegion): diff --git a/scripts/arm64-parsedump.py b/scripts/arm64-parsedump.py index c695706f..54f4fd66 100755 --- a/scripts/arm64-parsedump.py +++ b/scripts/arm64-parsedump.py @@ -14,7 +14,6 @@ # the COPYING file in the top-level directory. -from __future__ import print_function import subprocess import sys import fileinput diff --git a/tools/jailhouse-cell-linux b/tools/jailhouse-cell-linux index 6d1743f3..a1650912 100755 --- a/tools/jailhouse-cell-linux +++ b/tools/jailhouse-cell-linux @@ -10,7 +10,6 @@ # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. -from __future__ import print_function import argparse import gzip import os diff --git a/tools/jailhouse-cell-stats b/tools/jailhouse-cell-stats index 4c5289fb..7a634212 100755 --- a/tools/jailhouse-cell-stats +++ b/tools/jailhouse-cell-stats @@ -10,7 +10,6 @@ # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. -from __future__ import print_function import curses import datetime import os diff --git a/tools/jailhouse-config-check b/tools/jailhouse-config-check index 62db24c3..d6ea7079 100755 --- a/tools/jailhouse-config-check +++ b/tools/jailhouse-config-check @@ -15,7 +15,6 @@ # information about the system. For more advanced scenarios you will have # to change the generated C-code. -from __future__ import print_function import argparse import os import sys diff --git a/tools/jailhouse-config-create b/tools/jailhouse-config-create index 2095f4e2..c2cd5952 100755 --- a/tools/jailhouse-config-create +++ b/tools/jailhouse-config-create @@ -18,7 +18,6 @@ # information about the system. For more advanced scenarios you will have # to change the generated C-code. -from __future__ import print_function import sys import os import math diff --git a/tools/jailhouse-hardware-check b/tools/jailhouse-hardware-check index 7a41b48e..fc8ce4f1 100755 --- a/tools/jailhouse-hardware-check +++ b/tools/jailhouse-hardware-check @@ -10,7 +10,6 @@ # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. -from __future__ import print_function import mmap import os import struct @@ -20,10 +19,6 @@ import sys sys.path[0] = os.path.dirname(os.path.abspath(__file__)) + "/.." import pyjailhouse.sysfs_parser as sysfs_parser -# just a dummy to make python2 happy -if sys.version_info[0] < 3: - class PermissionError(OSError): - pass check_passed = True ran_all = True -- 2.31.1 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/20210622090502.231179-4-florian.bezdeka%40siemens.com.
