mirror of
https://src.fedoraproject.org/rpms/virt-manager.git
synced 2025-07-15 16:53:32 +00:00
Upstream fix backport to work with python 3.13 in rawhide
This commit is contained in:
265
0001-Fix-pylint-pycodestyle-warnings-with-latest-versions.patch
Normal file
265
0001-Fix-pylint-pycodestyle-warnings-with-latest-versions.patch
Normal file
@ -0,0 +1,265 @@
|
||||
From bb1afaba29019605a240a57d6b3ca8eb36341d9b Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Tue, 13 Dec 2022 10:51:14 -0500
|
||||
Subject: [PATCH] Fix pylint/pycodestyle warnings with latest versions
|
||||
|
||||
Signed-off-by: Cole Robinson <crobinso@redhat.com>
|
||||
---
|
||||
setup.py | 2 +-
|
||||
tests/test_disk.py | 1 +
|
||||
virtManager/addhardware.py | 6 +++---
|
||||
virtManager/details/sshtunnels.py | 2 +-
|
||||
virtManager/lib/statsmanager.py | 2 +-
|
||||
virtManager/object/domain.py | 4 ++--
|
||||
virtinst/cli.py | 8 ++++----
|
||||
virtinst/domcapabilities.py | 2 +-
|
||||
virtinst/pollhelpers.py | 2 +-
|
||||
virtinst/virtinstall.py | 20 ++++++++++----------
|
||||
virtinst/xmlbuilder.py | 6 +++---
|
||||
11 files changed, 28 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/setup.py b/setup.py
|
||||
index b45d315a..4bf29f25 100755
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -29,7 +29,7 @@ import setuptools.command.install_egg_info
|
||||
#
|
||||
# Newer setuptools will transparently support 'import distutils' though.
|
||||
# That can be overridden with SETUPTOOLS_USE_DISTUTILS env variable
|
||||
-import distutils.command.build # pylint: disable=wrong-import-order
|
||||
+import distutils.command.build # pylint: disable=wrong-import-order,deprecated-module
|
||||
|
||||
|
||||
SYSPREFIX = sysconfig.get_config_var("prefix")
|
||||
diff --git a/tests/test_disk.py b/tests/test_disk.py
|
||||
index ef065157..9127371b 100644
|
||||
--- a/tests/test_disk.py
|
||||
+++ b/tests/test_disk.py
|
||||
@@ -82,6 +82,7 @@ def test_disk_dir_searchable(monkeypatch):
|
||||
searchdata = virtinst.DeviceDisk.check_path_search(conn,
|
||||
tmpdir + "/footest")
|
||||
assert searchdata.uid == os.getuid()
|
||||
+ # pylint: disable=use-implicit-booleaness-not-comparison
|
||||
assert searchdata.fixlist == []
|
||||
|
||||
# Remove perms on the tmpdir, now it should report failures
|
||||
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
|
||||
index 0a8e33d3..aec48dd2 100644
|
||||
--- a/virtManager/addhardware.py
|
||||
+++ b/virtManager/addhardware.py
|
||||
@@ -371,8 +371,8 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
|
||||
msg = _("These changes will take effect after "
|
||||
"the next guest shutdown.")
|
||||
- dtype = (hotplug_err and
|
||||
- Gtk.MessageType.WARNING or Gtk.MessageType.INFO)
|
||||
+ dtype = (Gtk.MessageType.WARNING if hotplug_err else
|
||||
+ Gtk.MessageType.INFO)
|
||||
hotplug_msg = ""
|
||||
if hotplug_err:
|
||||
hotplug_msg += (hotplug_err[0] + "\n\n" +
|
||||
@@ -1560,7 +1560,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
controller_num = [x for x in controllers if
|
||||
(x.type == controller_type)]
|
||||
if len(controller_num) > 0:
|
||||
- index_new = max([x.index for x in controller_num]) + 1
|
||||
+ index_new = max(x.index for x in controller_num) + 1
|
||||
dev.index = index_new
|
||||
|
||||
dev.type = controller_type
|
||||
diff --git a/virtManager/details/sshtunnels.py b/virtManager/details/sshtunnels.py
|
||||
index 9afc1e13..cb7ca7c0 100644
|
||||
--- a/virtManager/details/sshtunnels.py
|
||||
+++ b/virtManager/details/sshtunnels.py
|
||||
@@ -22,7 +22,7 @@ class ConnectionInfo(object):
|
||||
"""
|
||||
def __init__(self, conn, gdev):
|
||||
self.gtype = gdev.type
|
||||
- self.gport = gdev.port and str(gdev.port) or None
|
||||
+ self.gport = str(gdev.port) if gdev.port else None
|
||||
self.gsocket = (gdev.listens and gdev.listens[0].socket) or gdev.socket
|
||||
self.gaddr = gdev.listen or "127.0.0.1"
|
||||
self.gtlsport = gdev.tlsPort or None
|
||||
diff --git a/virtManager/lib/statsmanager.py b/virtManager/lib/statsmanager.py
|
||||
index 28495495..ece130ab 100644
|
||||
--- a/virtManager/lib/statsmanager.py
|
||||
+++ b/virtManager/lib/statsmanager.py
|
||||
@@ -66,7 +66,7 @@ class _VMStatsList(vmmGObject):
|
||||
expected = self.config.get_stats_history_length()
|
||||
current = len(self._stats)
|
||||
if current > expected: # pragma: no cover
|
||||
- del(self._stats[expected:current])
|
||||
+ del self._stats[expected:current]
|
||||
|
||||
def _calculate_rate(record_name):
|
||||
ret = 0.0
|
||||
diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py
|
||||
index 2d6f5bca..1570b952 100644
|
||||
--- a/virtManager/object/domain.py
|
||||
+++ b/virtManager/object/domain.py
|
||||
@@ -1306,10 +1306,10 @@ class vmmDomain(vmmLibvirtObject):
|
||||
def get_arch(self):
|
||||
return self.get_xmlobj().os.arch
|
||||
def get_init(self):
|
||||
- import pipes
|
||||
+ import shlex
|
||||
init = self.get_xmlobj().os.init
|
||||
initargs = " ".join(
|
||||
- [pipes.quote(i.val) for i in self.get_xmlobj().os.initargs])
|
||||
+ [shlex.quote(i.val) for i in self.get_xmlobj().os.initargs])
|
||||
return init, initargs
|
||||
|
||||
def get_emulator(self):
|
||||
diff --git a/virtinst/cli.py b/virtinst/cli.py
|
||||
index 8dbffeb6..7615f743 100644
|
||||
--- a/virtinst/cli.py
|
||||
+++ b/virtinst/cli.py
|
||||
@@ -85,7 +85,7 @@ class VirtHelpFormatter(argparse.RawDescriptionHelpFormatter):
|
||||
'''
|
||||
oldwrap = None
|
||||
|
||||
- # pylint: disable=arguments-differ
|
||||
+ # pylint: disable=arguments-differ,protected-access
|
||||
def _split_lines(self, *args, **kwargs):
|
||||
def return_default():
|
||||
return argparse.RawDescriptionHelpFormatter._split_lines(
|
||||
@@ -1690,7 +1690,7 @@ def convert_old_force(options):
|
||||
if options.force:
|
||||
if not options.check:
|
||||
options.check = "all=off"
|
||||
- del(options.force)
|
||||
+ del options.force
|
||||
|
||||
|
||||
class ParserCheck(VirtCLIParser):
|
||||
@@ -2281,7 +2281,7 @@ class ParserCPU(VirtCLIParser):
|
||||
policy = "disable"
|
||||
|
||||
if policy:
|
||||
- del(self.optdict[key])
|
||||
+ del self.optdict[key]
|
||||
converted[policy].append(key[1:])
|
||||
|
||||
self.optdict.update(converted)
|
||||
@@ -2753,7 +2753,7 @@ class ParserBoot(VirtCLIParser):
|
||||
if cliname not in inst.BOOT_DEVICES:
|
||||
continue
|
||||
|
||||
- del(self.optdict[cliname])
|
||||
+ del self.optdict[cliname]
|
||||
if cliname not in boot_order:
|
||||
boot_order.append(cliname)
|
||||
|
||||
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
|
||||
index d22ce6a2..1b5b6bf6 100644
|
||||
--- a/virtinst/domcapabilities.py
|
||||
+++ b/virtinst/domcapabilities.py
|
||||
@@ -334,7 +334,7 @@ class DomainCapabilities(XMLBuilder):
|
||||
"""
|
||||
Return True if we know how to setup UEFI for the passed arch
|
||||
"""
|
||||
- return self.arch in list(self._uefi_arch_patterns.keys())
|
||||
+ return self.arch in self._uefi_arch_patterns
|
||||
|
||||
def supports_uefi_loader(self):
|
||||
"""
|
||||
diff --git a/virtinst/pollhelpers.py b/virtinst/pollhelpers.py
|
||||
index ef695914..f9fcc3fa 100644
|
||||
--- a/virtinst/pollhelpers.py
|
||||
+++ b/virtinst/pollhelpers.py
|
||||
@@ -32,7 +32,7 @@ def _new_poll_helper(origmap, typename, list_cb, build_cb, support_cb):
|
||||
else:
|
||||
# Previously known object
|
||||
current[name] = origmap[name]
|
||||
- del(origmap[name])
|
||||
+ del origmap[name]
|
||||
|
||||
return (list(origmap.values()), list(new.values()), list(current.values()))
|
||||
|
||||
diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py
|
||||
index 8fcc8ce1..130c8e28 100644
|
||||
--- a/virtinst/virtinstall.py
|
||||
+++ b/virtinst/virtinstall.py
|
||||
@@ -67,7 +67,7 @@ def check_cdrom_option_error(options):
|
||||
def convert_old_printxml(options):
|
||||
if options.xmlstep:
|
||||
options.xmlonly = options.xmlstep
|
||||
- del(options.xmlstep)
|
||||
+ del options.xmlstep
|
||||
|
||||
|
||||
def convert_old_sound(options):
|
||||
@@ -135,10 +135,10 @@ def convert_old_disks(options):
|
||||
else:
|
||||
_do_convert_old_disks(options)
|
||||
|
||||
- del(options.file_paths)
|
||||
- del(options.disksize)
|
||||
- del(options.sparse)
|
||||
- del(options.nodisks)
|
||||
+ del options.file_paths
|
||||
+ del options.disksize
|
||||
+ del options.sparse
|
||||
+ del options.nodisks
|
||||
log.debug("Distilled --disk options: %s", options.disk)
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ def convert_old_os_options(options):
|
||||
return
|
||||
log.warning(
|
||||
_("--os-type is deprecated and does nothing. Please stop using it."))
|
||||
- del(options.old_os_type)
|
||||
+ del options.old_os_type
|
||||
|
||||
|
||||
def convert_old_memory(options):
|
||||
@@ -204,9 +204,9 @@ def convert_old_networks(options):
|
||||
networks[idx] = networks[idx].replace(prefix + ":",
|
||||
prefix + "=")
|
||||
|
||||
- del(options.mac)
|
||||
- del(options.bridge)
|
||||
- del(options.nonetworks)
|
||||
+ del options.mac
|
||||
+ del options.bridge
|
||||
+ del options.nonetworks
|
||||
|
||||
options.network = networks
|
||||
log.debug("Distilled --network options: %s", options.network)
|
||||
@@ -224,7 +224,7 @@ def convert_old_graphics(options):
|
||||
if graphics and (vnc or sdl or keymap or vncport or vnclisten):
|
||||
fail(_("Cannot mix --graphics and old style graphical options"))
|
||||
|
||||
- optnum = sum([bool(g) for g in [vnc, nographics, sdl, graphics]])
|
||||
+ optnum = sum(bool(g) for g in [vnc, nographics, sdl, graphics])
|
||||
if optnum > 1:
|
||||
raise ValueError(_("Can't specify more than one of VNC, SDL, "
|
||||
"--graphics or --nographics"))
|
||||
diff --git a/virtinst/xmlbuilder.py b/virtinst/xmlbuilder.py
|
||||
index 07a9e319..dd78038e 100644
|
||||
--- a/virtinst/xmlbuilder.py
|
||||
+++ b/virtinst/xmlbuilder.py
|
||||
@@ -262,9 +262,9 @@ class XMLProperty(_XMLPropertyBase):
|
||||
self._is_onoff = is_onoff
|
||||
self._do_abspath = do_abspath
|
||||
|
||||
- conflicts = sum([int(bool(i)) for i in
|
||||
+ conflicts = sum(int(bool(i)) for i in
|
||||
[self._is_bool, self._is_int,
|
||||
- self._is_yesno, self._is_onoff]])
|
||||
+ self._is_yesno, self._is_onoff])
|
||||
if conflicts > 1:
|
||||
raise xmlutil.DevError("Conflict property converter options.")
|
||||
|
||||
@@ -343,7 +343,7 @@ class XMLProperty(_XMLPropertyBase):
|
||||
propstore = xmlbuilder._propstore
|
||||
|
||||
if self.propname in propstore:
|
||||
- del(propstore[self.propname])
|
||||
+ del propstore[self.propname]
|
||||
propstore[self.propname] = val
|
||||
|
||||
def _nonxml_fget(self, xmlbuilder):
|
||||
--
|
||||
2.45.2
|
||||
|
@ -17,6 +17,8 @@ BuildArch: noarch
|
||||
URL: https://virt-manager.org/
|
||||
Source0: https://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.gz
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2294201
|
||||
Patch1: 0001-Fix-pylint-pycodestyle-warnings-with-latest-versions.patch
|
||||
|
||||
Requires: virt-manager-common = %{verrel}
|
||||
Requires: python3-gobject >= 3.31.3
|
||||
|
Reference in New Issue
Block a user