virt-manager/virtman-python2-to-python3-conversion.patch

292 lines
10 KiB
Diff

Index: virt-manager-2.1.0/virt-manager
===================================================================
--- virt-manager-2.1.0.orig/virt-manager
+++ virt-manager-2.1.0/virt-manager
@@ -66,7 +66,7 @@ def _import_gtk(leftovers):
print("gtk3 3.14.0 or later is required.")
sys.exit(1)
- if os.environ.has_key('DISPLAY') and os.environ['DISPLAY']:
+ if 'DISPLAY' in os.environ and os.environ['DISPLAY']:
# This will error if Gtk wasn't correctly initialized
Gtk.Window()
else:
Index: virt-manager-2.1.0/virtManager/network.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/network.py
+++ virt-manager-2.1.0/virtManager/network.py
@@ -110,7 +110,7 @@ class vmmNetwork(vmmLibvirtObject):
def set_qos(self, **kwargs):
xmlobj = self._make_xmlobj_to_define()
q = xmlobj.bandwidth
- for key, val in kwargs.items():
+ for key, val in list(kwargs.items()):
setattr(q, key, val)
self._redefine_xmlobj(xmlobj)
Index: virt-manager-2.1.0/virtManager/console.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/console.py
+++ virt-manager-2.1.0/virtManager/console.py
@@ -21,7 +21,7 @@ from .viewers import SpiceViewer, VNCVie
(_CONSOLE_PAGE_UNAVAILABLE,
_CONSOLE_PAGE_AUTHENTICATE,
_CONSOLE_PAGE_SERIAL,
- _CONSOLE_PAGE_VIEWER) = range(4)
+ _CONSOLE_PAGE_VIEWER) = list(range(4))
class _TimedRevealer(vmmGObject):
Index: virt-manager-2.1.0/virtManager/connection.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/connection.py
+++ virt-manager-2.1.0/virtManager/connection.py
@@ -165,7 +165,7 @@ class vmmConnection(vmmGObject):
(_STATE_DISCONNECTED,
_STATE_CONNECTING,
- _STATE_ACTIVE) = range(1, 4)
+ _STATE_ACTIVE) = list(range(1, 4))
def __init__(self, uri):
self._uri = uri
Index: virt-manager-2.1.0/virtManager/addhardware.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/addhardware.py
+++ virt-manager-2.1.0/virtManager/addhardware.py
@@ -43,7 +43,7 @@ from .vsockdetails import vmmVsockDetail
PAGE_TPM,
PAGE_RNG,
PAGE_PANIC,
- PAGE_VSOCK) = range(18)
+ PAGE_VSOCK) = list(range(18))
def _build_combo(combo, values, default_value=None, sort=True):
@@ -889,7 +889,7 @@ class vmmAddHardware(vmmGObjectUI):
self._dev = DeviceTpm(self.conn.get_backend())
self._dev.type = devtype
- for param_name, widget_name in tpm_widget_mappings.items():
+ for param_name, widget_name in list(tpm_widget_mappings.items()):
make_visible = self._dev.supports_property(param_name)
uiutil.set_grid_row_visible(self.widget(widget_name + "-label"),
make_visible)
Index: virt-manager-2.1.0/virtManager/snapshots.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/snapshots.py
+++ virt-manager-2.1.0/virtManager/snapshots.py
@@ -30,7 +30,7 @@ mimemap = {
def _mime_to_ext(val, reverse=False):
- for m, e in mimemap.items():
+ for m, e in list(mimemap.items()):
if val == m and not reverse:
return e
if val == e and reverse:
Index: virt-manager-2.1.0/virtManager/engine.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/engine.py
+++ virt-manager-2.1.0/virtManager/engine.py
@@ -21,7 +21,7 @@ from .inspection import vmmInspection
from .systray import vmmSystray
(PRIO_HIGH,
- PRIO_LOW) = range(1, 3)
+ PRIO_LOW) = list(range(1, 3))
def _show_startup_error(fn):
Index: virt-manager-2.1.0/virtManager/mediacombo.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/mediacombo.py
+++ virt-manager-2.1.0/virtManager/mediacombo.py
@@ -22,7 +22,7 @@ class vmmMediaCombo(vmmGObjectUI):
(MEDIA_FIELD_PATH,
MEDIA_FIELD_LABEL,
MEDIA_FIELD_HAS_MEDIA,
- MEDIA_FIELD_KEY) = range(MEDIA_FIELDS_NUM)
+ MEDIA_FIELD_KEY) = list(range(MEDIA_FIELDS_NUM))
def __init__(self, conn, builder, topwin):
vmmGObjectUI.__init__(self, None, None, builder=builder, topwin=topwin)
Index: virt-manager-2.1.0/virtManager/manager.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/manager.py
+++ virt-manager-2.1.0/virtManager/manager.py
@@ -36,7 +36,7 @@ ROW_IS_CONN_CONNECTED,
ROW_IS_VM,
ROW_IS_VM_RUNNING,
ROW_COLOR,
-ROW_INSPECTION_OS_ICON) = range(11)
+ROW_INSPECTION_OS_ICON) = list(range(11))
# Columns in the tree view
(COL_NAME,
@@ -44,7 +44,7 @@ COL_GUEST_CPU,
COL_HOST_CPU,
COL_MEM,
COL_DISK,
-COL_NETWORK) = range(6)
+COL_NETWORK) = list(range(6))
def _style_get_prop(widget, propname):
Index: virt-manager-2.1.0/virtManager/addstorage.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/addstorage.py
+++ virt-manager-2.1.0/virtManager/addstorage.py
@@ -148,7 +148,7 @@ class vmmAddStorage(vmmGObjectUI):
errmsg = _("Errors were encountered changing permissions for the "
"following directories:")
details = ""
- for p, error in errors.items():
+ for p, error in list(errors.items()):
if p not in broken_paths:
continue
details += "%s : %s\n" % (p, error)
Index: virt-manager-2.1.0/virtManager/details.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/details.py
+++ virt-manager-2.1.0/virtManager/details.py
@@ -105,7 +105,7 @@ from .vsockdetails import vmmVsockDetail
EDIT_FS,
- EDIT_HOSTDEV_ROMBAR) = range(1, 58)
+ EDIT_HOSTDEV_ROMBAR) = list(range(1, 58))
# Columns in hw list model
@@ -113,7 +113,7 @@ from .vsockdetails import vmmVsockDetail
HW_LIST_COL_ICON_NAME,
HW_LIST_COL_ICON_SIZE,
HW_LIST_COL_TYPE,
- HW_LIST_COL_DEVICE) = range(5)
+ HW_LIST_COL_DEVICE) = list(range(5))
# Types for the hw list model: numbers specify what order they will be listed
(HW_LIST_TYPE_GENERAL,
@@ -138,7 +138,7 @@ from .vsockdetails import vmmVsockDetail
HW_LIST_TYPE_TPM,
HW_LIST_TYPE_RNG,
HW_LIST_TYPE_PANIC,
- HW_LIST_TYPE_VSOCK) = range(23)
+ HW_LIST_TYPE_VSOCK) = list(range(23))
remove_pages = [HW_LIST_TYPE_NIC, HW_LIST_TYPE_INPUT,
HW_LIST_TYPE_GRAPHICS, HW_LIST_TYPE_SOUND, HW_LIST_TYPE_CHAR,
@@ -153,12 +153,12 @@ remove_pages = [HW_LIST_TYPE_NIC, HW_LIS
BOOT_LABEL,
BOOT_ICON,
BOOT_ACTIVE,
- BOOT_CAN_SELECT) = range(5)
+ BOOT_CAN_SELECT) = list(range(5))
# Main tab pages
(DETAILS_PAGE_DETAILS,
DETAILS_PAGE_CONSOLE,
- DETAILS_PAGE_SNAPSHOTS) = range(3)
+ DETAILS_PAGE_SNAPSHOTS) = list(range(3))
Index: virt-manager-2.1.0/virtManager/create.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/create.py
+++ virt-manager-2.1.0/virtManager/create.py
@@ -43,7 +43,7 @@ DEFAULT_MEM = 1024
PAGE_INSTALL,
PAGE_MEM,
PAGE_STORAGE,
- PAGE_FINISH) = range(5)
+ PAGE_FINISH) = list(range(5))
(INSTALL_PAGE_ISO,
INSTALL_PAGE_URL,
@@ -51,13 +51,13 @@ DEFAULT_MEM = 1024
INSTALL_PAGE_IMPORT,
INSTALL_PAGE_CONTAINER_APP,
INSTALL_PAGE_CONTAINER_OS,
- INSTALL_PAGE_VZ_TEMPLATE) = range(7)
+ INSTALL_PAGE_VZ_TEMPLATE) = list(range(7))
# Column numbers for os type/version list models
(OS_COL_ID,
OS_COL_LABEL,
OS_COL_IS_SEP,
- OS_COL_IS_SHOW_ALL) = range(4)
+ OS_COL_IS_SHOW_ALL) = list(range(4))
#####################
@@ -2156,7 +2156,7 @@ class vmmCreate(vmmGObjectUI):
'insecure': self._get_config_oscontainer_isecure,
'root_password': self._get_config_oscontainer_root_password,
}
- for key, getter in bootstrap_arg_keys.items():
+ for key, getter in list(bootstrap_arg_keys.items()):
bootstrap_args[key] = getter()
parentobj = self._customize_window or self
Index: virt-manager-2.1.0/virtManager/preferences.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/preferences.py
+++ virt-manager-2.1.0/virtManager/preferences.py
@@ -127,7 +127,7 @@ class vmmPreferences(vmmGObjectUI):
}
model.append([-1, _("System default (%s)") %
vals[self.config.default_console_resizeguest]])
- for key, val in vals.items():
+ for key, val in list(vals.items()):
model.append([key, val])
combo.set_model(model)
uiutil.init_combo_text_column(combo, 1)
Index: virt-manager-2.1.0/virtManager/migrate.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/migrate.py
+++ virt-manager-2.1.0/virtManager/migrate.py
@@ -23,7 +23,7 @@ from .domain import vmmDomain
NUM_COLS = 3
(COL_LABEL,
COL_URI,
- COL_CAN_MIGRATE) = range(NUM_COLS)
+ COL_CAN_MIGRATE) = list(range(NUM_COLS))
class vmmMigrateDialog(vmmGObjectUI):
Index: virt-manager-2.1.0/virtManager/storagelist.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/storagelist.py
+++ virt-manager-2.1.0/virtManager/storagelist.py
@@ -30,13 +30,13 @@ VOL_NUM_COLUMNS = 7
VOL_COLUMN_SIZESTR,
VOL_COLUMN_FORMAT,
VOL_COLUMN_INUSEBY,
- VOL_COLUMN_SENSITIVE) = range(VOL_NUM_COLUMNS)
+ VOL_COLUMN_SENSITIVE) = list(range(VOL_NUM_COLUMNS))
POOL_NUM_COLUMNS = 4
(POOL_COLUMN_CONNKEY,
POOL_COLUMN_LABEL,
POOL_COLUMN_ISACTIVE,
- POOL_COLUMN_PERCENT) = range(POOL_NUM_COLUMNS)
+ POOL_COLUMN_PERCENT) = list(range(POOL_NUM_COLUMNS))
ICON_RUNNING = "state_running"
ICON_SHUTOFF = "state_shutoff"
Index: virt-manager-2.1.0/virtManager/createnet.py
===================================================================
--- virt-manager-2.1.0.orig/virtManager/createnet.py
+++ virt-manager-2.1.0/virtManager/createnet.py
@@ -20,7 +20,7 @@ from .baseclass import vmmGObjectUI
(PAGE_NAME,
PAGE_IPV4,
PAGE_IPV6,
-PAGE_MISC) = range(4)
+PAGE_MISC) = list(range(4))
PAGE_MAX = PAGE_MISC