|
0 |
From 328ced84fe688db5ef0385f5c763cd948087d81f Mon Sep 17 00:00:00 2001
|
|
1 |
From: =?UTF-8?q?Ond=C5=99ej=20Budai?= <obudai@redhat.com>
|
|
2 |
Date: Fri, 2 Oct 2020 14:24:09 +0200
|
|
3 |
Subject: [PATCH] fix compatibility with Python 3.9
|
|
4 |
|
|
5 |
getchildren() method was removed from the ElementTree and Element classes in
|
|
6 |
Python 3.9. See the release notes:
|
|
7 |
|
|
8 |
https://docs.python.org/3.9/whatsnew/3.9.html#removed
|
|
9 |
---
|
|
10 |
S3/Exceptions.py | 2 +-
|
|
11 |
S3/Utils.py | 8 ++++----
|
|
12 |
2 files changed, 5 insertions(+), 5 deletions(-)
|
|
13 |
|
|
14 |
Index: s3cmd/S3/Exceptions.py
|
|
15 |
===================================================================
|
|
16 |
--- s3cmd.orig/S3/Exceptions.py
|
|
17 |
+++ s3cmd/S3/Exceptions.py
|
|
18 |
@@ -126,7 +126,7 @@ class S3Error (S3Exception):
|
|
19 |
if not error_node.tag == "Error":
|
|
20 |
error_node = tree.find(".//Error")
|
|
21 |
if error_node is not None:
|
|
22 |
- for child in error_node.getchildren():
|
|
23 |
+ for child in error_node:
|
|
24 |
if child.text != "":
|
|
25 |
debug("ErrorXML: " + child.tag + ": " + repr(child.text))
|
|
26 |
info[child.tag] = child.text
|
|
27 |
Index: s3cmd/S3/Utils.py
|
|
28 |
===================================================================
|
|
29 |
--- s3cmd.orig/S3/Utils.py
|
|
30 |
+++ s3cmd/S3/Utils.py
|
|
31 |
@@ -64,9 +64,9 @@ def parseNodes(nodes):
|
|
32 |
retval = []
|
|
33 |
for node in nodes:
|
|
34 |
retval_item = {}
|
|
35 |
- for child in node.getchildren():
|
|
36 |
+ for child in node:
|
|
37 |
name = decode_from_s3(child.tag)
|
|
38 |
- if child.getchildren():
|
|
39 |
+ if len(child):
|
|
40 |
retval_item[name] = parseNodes([child])
|
|
41 |
else:
|
|
42 |
found_text = node.findtext(".//%s" % child.tag)
|
|
43 |
@@ -122,8 +122,8 @@ __all__.append("getListFromXml")
|
|
44 |
|
|
45 |
def getDictFromTree(tree):
|
|
46 |
ret_dict = {}
|
|
47 |
- for child in tree.getchildren():
|
|
48 |
- if child.getchildren():
|
|
49 |
+ for child in tree:
|
|
50 |
+ if len(child):
|
|
51 |
## Complex-type child. Recurse
|
|
52 |
content = getDictFromTree(child)
|
|
53 |
else:
|