From 7e8f0ac8ff6268e5560dbc6b3a46d5edfe85b91e Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Tue, 11 Mar 2014 20:42:50 +0200 Subject: [PATCH] Fixed xml.etree future warning New distros come with new xml.etree API, which produces this warning when using oscapi: /usr/lib/python2.7/site-packages/gitbuildsys/oscapi.py:105: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. if element: This is also mentioned in the python documentation for xml.etree.find API: Caution: Elements with no subelements will test as False. This behavior will change in future versions. Use specific len(elem) or elem is None test instead. Fixes: #1706 Change-Id: I84c4a947125a8d96584fef609dc5266b97447c0e Signed-off-by: Ed Bartosh --- gitbuildsys/oscapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitbuildsys/oscapi.py b/gitbuildsys/oscapi.py index dcabc16..8755423 100644 --- a/gitbuildsys/oscapi.py +++ b/gitbuildsys/oscapi.py @@ -102,7 +102,7 @@ class OSC(object): result = '' for tag in tags: element = xml_root.find(tag) - if element: + if element is not None: result += ET.tostring(element) return result -- 2.34.1