From: Ed Bartosh Date: Tue, 11 Mar 2014 18:42:50 +0000 (+0200) Subject: Fixed xml.etree future warning X-Git-Tag: 0.21~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e8f0ac8ff6268e5560dbc6b3a46d5edfe85b91e;p=tools%2Fgbs.git 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 --- 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