Plugin fails on RHEL6.6 with SyntaxError due to old ElementTree module #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The version of ElementTree that ships with Python 2.6 only has support for "path/path" style XPath syntax, and cannot handle paths of the form "path/path[attr='val']/path", and will crash with a traceback similar to:
Traceback (most recent call last):
File "", line 1, in
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementTree.py", line 355, in findall
return ElementPath.findall(self, path)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementPath.py", line 198, in findall
return _compile(path).findall(element)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementPath.py", line 176, in _compile
p = Path(path)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/etree/ElementPath.py", line 93, in init
"expected path separator (%s)" % (op or tag)
SyntaxError: expected path separator ([)
This patch uses
lxml.etree
in place ofxml.etree.ElementTree
to retain Python 2.6 compatibility.