blob: 84271c4c982901b1db4fc4f72d4274b70c8c157b [file] [log] [blame]
Andrew Geisslerf31b8bd2020-11-30 19:54:56 -06001From b0adc1d53780def4a95e310b6d26bb91ee97177e Mon Sep 17 00:00:00 2001
2From: Vojtech Polasek <vpolasek@redhat.com>
3Date: Mon, 8 Jun 2020 13:27:41 +0200
4Subject: [PATCH] fix deprecated getiterator function
5
6Upstream-Status: Backport
7[https://github.com/ComplianceAsCode/content/commit/b0adc1d53780def4a95e310b6d26bb91ee97177e]
8
9Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
10---
11 ssg/build_cpe.py | 6 +++---
12 ssg/id_translate.py | 2 +-
13 2 files changed, 4 insertions(+), 4 deletions(-)
14
15diff --git a/ssg/build_cpe.py b/ssg/build_cpe.py
16index 2e5d24a5d..8c046777a 100644
17--- a/ssg/build_cpe.py
18+++ b/ssg/build_cpe.py
19@@ -17,7 +17,7 @@ def extract_subelement(objects, sub_elem_type):
20 """
21
22 for obj in objects:
23- for subelement in obj.getiterator():
24+ for subelement in obj.iter():
25 if subelement.get(sub_elem_type):
26 sub_element = subelement.get(sub_elem_type)
27 return sub_element
28@@ -44,12 +44,12 @@ def extract_referred_nodes(tree_with_refs, tree_with_ids, attrname):
29 reflist = []
30 elementlist = []
31
32- for element in tree_with_refs.getiterator():
33+ for element in tree_with_refs.iter():
34 value = element.get(attrname)
35 if value is not None:
36 reflist.append(value)
37
38- for element in tree_with_ids.getiterator():
39+ for element in tree_with_ids.iter():
40 if element.get("id") in reflist:
41 elementlist.append(element)
42
43diff --git a/ssg/id_translate.py b/ssg/id_translate.py
44index 72b07be18..ba9225904 100644
45--- a/ssg/id_translate.py
46+++ b/ssg/id_translate.py
47@@ -64,7 +64,7 @@ class IDTranslator(object):
48 )
49
50 def translate(self, tree, store_defname=False):
51- for element in tree.getiterator():
52+ for element in tree.iter():
53 idname = element.get("id")
54 if idname:
55 # store the old name if requested (for OVAL definitions)
56--
572.17.1
58