replace getiterator() by iter():Method geiterator() has been removed in py3.8 12/292412/1
authorwang biao <biao716.wang@samsung.com>
Sat, 6 May 2023 02:41:51 +0000 (10:41 +0800)
committerwang biao <biao716.wang@samsung.com>
Sat, 6 May 2023 02:47:02 +0000 (10:47 +0800)
Change-Id: Ibe0f92dfd9e9a5bc5cd4f26dc507e8f6830251d9
Signed-off-by: wang biao <biao716.wang@samsung.com>
mic/utils/misc.py

index f2b3c0b012bf986eeb36023dadec73904bb16290..2898f1d57adf9ddaafcdecac43b6873d56b62a13 100755 (executable)
@@ -562,14 +562,14 @@ def get_metadata_from_repos(repos, cachedir):
         checksums = {}
         sumtypes = {}
 
-        for elm in root.getiterator("%sdata" % ns):
+        for elm in root.iter("%sdata" % ns):
             if elm.attrib["type"] == "patterns":
                 filepaths['patterns'] = elm.find("%slocation" % ns).attrib['href']
                 checksums['patterns'] = elm.find("%sopen-checksum" % ns).text
                 sumtypes['patterns'] = elm.find("%sopen-checksum" % ns).attrib['type']
                 break
 
-        for elm in root.getiterator("%sdata" % ns):
+        for elm in root.iter("%sdata" % ns):
             #"group" type has no "open-checksum" filed, remove it.
             if elm.attrib["type"] == "group_gz":
                 filepaths['comps'] = elm.find("%slocation" % ns).attrib['href']
@@ -578,7 +578,7 @@ def get_metadata_from_repos(repos, cachedir):
                 break
 
         primary_type = None
-        for elm in root.getiterator("%sdata" % ns):
+        for elm in root.iter("%sdata" % ns):
             if elm.attrib["type"] in ("primary_db", "primary"):
                 primary_type = elm.attrib["type"]
                 filepaths['primary'] = elm.find("%slocation" % ns).attrib['href']
@@ -635,7 +635,7 @@ def get_rpmver_in_repo(repometadata):
             ns = ns[0:ns.rindex("}")+1]
 
             versionlist = []
-            for elm in root.getiterator("%spackage" % ns):
+            for elm in root.iter("%spackage" % ns):
                 if elm.find("%sname" % ns).text == 'rpm':
                     for node in elm.getchildren():
                         if node.tag == "%sversion" % ns:
@@ -663,7 +663,7 @@ def get_arch(repometadata):
             root = xmlparse(repo["primary"])
             ns = root.getroot().tag
             ns = ns[0:ns.rindex("}")+1]
-            for elm in root.getiterator("%spackage" % ns):
+            for elm in root.iter("%spackage" % ns):
                 if elm.find("%sarch" % ns).text not in ("noarch", "src"):
                     arch = elm.find("%sarch" % ns).text
                     if arch not in archlist:
@@ -716,7 +716,7 @@ def get_package(pkg, repometadata, arch = None):
             root = xmlparse(repo["primary"])
             ns = root.getroot().tag
             ns = ns[0:ns.rindex("}")+1]
-            for elm in root.getiterator("%spackage" % ns):
+            for elm in root.iter("%spackage" % ns):
                 if elm.find("%sname" % ns).text == pkg and elm.find("%sarch" % ns).text in arches:
                     if repo["priority"] != None:
                         tmpprior = int(repo["priority"])
@@ -804,7 +804,7 @@ def get_source_name(pkg, repometadata):
             root = xmlparse(repo["primary"])
             ns = root.getroot().tag
             ns = ns[0:ns.rindex("}")+1]
-            for elm in root.getiterator("%spackage" % ns):
+            for elm in root.iter("%spackage" % ns):
                 if elm.find("%sname" % ns).text == pkg_name:
                     if elm.find("%sarch" % ns).text != "src":
                         version = elm.find("%sversion" % ns)
@@ -877,7 +877,7 @@ def get_pkglist_in_comps(group, comps):
     except SyntaxError:
         raise SyntaxError("%s syntax error." % comps)
 
-    for elm in root.getiterator("group"):
+    for elm in root.iter("group"):
         id = elm.find("id")
         name = elm.find("name")
         if id.text == group or name.text == group:
@@ -888,7 +888,7 @@ def get_pkglist_in_comps(group, comps):
     if not found:
         return pkglist
 
-    for require in elm.getiterator("packagereq"):
+    for require in elm.iter("packagereq"):
         if require.tag.endswith("packagereq"):
             pkgname = require.text
         if pkgname not in pkglist: