python3.9 - xml module removed elem.getchildren() method, use list(elem)
This commit is contained in:
parent
bd7d355c85
commit
d2cf99ef3e
135
system-config-printer-getchildren-removed.patch
Normal file
135
system-config-printer-getchildren-removed.patch
Normal file
@ -0,0 +1,135 @@
|
||||
diff --git a/cupshelpers/openprinting.py b/cupshelpers/openprinting.py
|
||||
index c616d913..9bb4764c 100755
|
||||
--- a/cupshelpers/openprinting.py
|
||||
+++ b/cupshelpers/openprinting.py
|
||||
@@ -338,7 +338,7 @@ class OpenPrinting:
|
||||
packages = {}
|
||||
container = driver.find ('packages')
|
||||
if container is not None:
|
||||
- for arch in container.getchildren ():
|
||||
+ for arch in list(container):
|
||||
rpms = {}
|
||||
for package in arch.findall ('package'):
|
||||
rpm = {}
|
||||
@@ -351,7 +351,7 @@ class OpenPrinting:
|
||||
|
||||
repositories = package.find ('repositories')
|
||||
if repositories is not None:
|
||||
- for pkgsys in repositories.getchildren ():
|
||||
+ for pkgsys in list(repositories):
|
||||
rpm.setdefault('repositories', {})[pkgsys.tag] = pkgsys.text
|
||||
|
||||
rpms[package.attrib['file']] = rpm
|
||||
@@ -363,7 +363,7 @@ class OpenPrinting:
|
||||
ppds = []
|
||||
container = driver.find ('ppds')
|
||||
if container is not None:
|
||||
- for each in container.getchildren ():
|
||||
+ for each in list(container):
|
||||
ppds.append (each.text)
|
||||
|
||||
if ppds:
|
||||
diff --git a/cupshelpers/xmldriverprefs.py b/cupshelpers/xmldriverprefs.py
|
||||
index 4177e1c0..0d02950f 100644
|
||||
--- a/cupshelpers/xmldriverprefs.py
|
||||
+++ b/cupshelpers/xmldriverprefs.py
|
||||
@@ -27,7 +27,7 @@ from .cupshelpers import parseDeviceID
|
||||
|
||||
def PreferredDrivers (filename):
|
||||
preferreddrivers = xml.etree.ElementTree.XML (open (filename).read ())
|
||||
- return preferreddrivers.getchildren()
|
||||
+ return list(preferreddrivers)
|
||||
|
||||
class DeviceIDMatch:
|
||||
"""
|
||||
@@ -227,10 +227,10 @@ class DriverTypes:
|
||||
"""
|
||||
|
||||
types = []
|
||||
- for drivertype in drivertypes.getchildren ():
|
||||
+ for drivertype in list(drivertypes):
|
||||
t = DriverType (drivertype.attrib["name"])
|
||||
|
||||
- for child in drivertype.getchildren ():
|
||||
+ for child in list(drivertype):
|
||||
if child.tag == "ppdname":
|
||||
t.add_ppd_name (child.attrib["match"])
|
||||
elif child.tag == "attribute":
|
||||
@@ -238,7 +238,7 @@ class DriverTypes:
|
||||
child.attrib["match"])
|
||||
elif child.tag == "deviceid":
|
||||
deviceid_match = DeviceIDMatch ()
|
||||
- for field in child.getchildren ():
|
||||
+ for field in list(child):
|
||||
if field.tag == "field":
|
||||
deviceid_match.add_field (field.attrib["name"],
|
||||
field.attrib["match"])
|
||||
@@ -414,29 +414,29 @@ class PreferenceOrder:
|
||||
Load the policy from an XML file.
|
||||
"""
|
||||
|
||||
- for printer in preferreddrivers.getchildren ():
|
||||
+ for printer in list(preferreddrivers):
|
||||
ptype = PrinterType ()
|
||||
- for child in printer.getchildren ():
|
||||
+ for child in list(printer):
|
||||
if child.tag == "make-and-model":
|
||||
ptype.add_make_and_model (child.attrib["match"])
|
||||
elif child.tag == "deviceid":
|
||||
deviceid_match = DeviceIDMatch ()
|
||||
- for field in child.getchildren ():
|
||||
+ for field in list(child):
|
||||
if field.tag == "field":
|
||||
deviceid_match.add_field (field.attrib["name"],
|
||||
field.attrib["match"])
|
||||
ptype.add_deviceid_match (deviceid_match)
|
||||
|
||||
elif child.tag == "drivers":
|
||||
- for drivertype in child.getchildren ():
|
||||
+ for drivertype in list(child):
|
||||
ptype.add_drivertype_pattern (drivertype.text)
|
||||
|
||||
elif child.tag == "avoid":
|
||||
- for drivertype in child.getchildren ():
|
||||
+ for drivertype in list(child):
|
||||
ptype.add_avoidtype_pattern (drivertype.text)
|
||||
|
||||
elif child.tag == "blacklist":
|
||||
- for drivertype in child.getchildren ():
|
||||
+ for drivertype in list(child):
|
||||
ptype.add_blacklisted (drivertype.text)
|
||||
|
||||
self.ptypes.append (ptype)
|
||||
diff --git a/xml/validate.py b/xml/validate.py
|
||||
index 8fc201ec..ba16766d 100644
|
||||
--- a/xml/validate.py
|
||||
+++ b/xml/validate.py
|
||||
@@ -35,23 +35,23 @@ class Validator:
|
||||
filename = self._filename
|
||||
print ("Validating %s" % filename)
|
||||
preferreddrivers = xml.etree.ElementTree.XML (open (filename).read ())
|
||||
- (drivertypes, preferenceorder) = preferreddrivers.getchildren ()
|
||||
+ (drivertypes, preferenceorder) = list(preferreddrivers)
|
||||
validates = True
|
||||
|
||||
names = set()
|
||||
- for drivertype in drivertypes.getchildren ():
|
||||
+ for drivertype in list(drivertypes):
|
||||
name = drivertype.get ("name")
|
||||
names.add (name)
|
||||
|
||||
- for printer in preferenceorder.getchildren ():
|
||||
+ for printer in list(preferenceorder):
|
||||
types = []
|
||||
drivers = printer.find ("drivers")
|
||||
if drivers is not None:
|
||||
- types.extend (drivers.getchildren ())
|
||||
+ types.extend (list(drivers))
|
||||
|
||||
blacklist = printer.find ("blacklist")
|
||||
if blacklist is not None:
|
||||
- types.extend (blacklist.getchildren ())
|
||||
+ types.extend (list(blacklist))
|
||||
|
||||
for drivertype in types:
|
||||
pattern = drivertype.text.strip ()
|
@ -9,13 +9,14 @@
|
||||
Summary: A printer administration tool
|
||||
Name: system-config-printer
|
||||
Version: 1.5.12
|
||||
Release: 6%{?dist}
|
||||
Release: 7%{?dist}
|
||||
License: GPLv2+
|
||||
URL: https://github.com/%{username}/%{name}
|
||||
Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.gz
|
||||
|
||||
# all upstream patches, remove with new release
|
||||
Patch01: 0001-udev-configure-printer-Add-checks-for-NULL.patch
|
||||
Patch02: system-config-printer-getchildren-removed.patch
|
||||
|
||||
# gcc is no longer in buildroot by default
|
||||
# gcc is needed for udev-configure-printer.c
|
||||
@ -88,6 +89,7 @@ printers.
|
||||
%setup -q
|
||||
# all backported from upstream
|
||||
%patch01 -p1 -b .udev-configure-segfault
|
||||
%patch02 -p1 -b .getchildren-removed
|
||||
|
||||
%build
|
||||
%configure --with-udev-rules
|
||||
@ -213,6 +215,9 @@ touch %buildroot%{_localstatedir}/run/udev-configure-printer/usb-uris
|
||||
exit 0
|
||||
|
||||
%changelog
|
||||
* Wed Jul 22 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.5.12-7
|
||||
- python3.9 - xml module removed elem.getchildren() method, use list(elem)
|
||||
|
||||
* Tue Jul 14 2020 Tom Stellard <tstellar@redhat.com> - 1.5.12-6
|
||||
- Use make macros
|
||||
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
|
||||
|
Loading…
Reference in New Issue
Block a user