136 lines
5.8 KiB
Diff
136 lines
5.8 KiB
Diff
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 ()
|