You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@ambari.apache.org by Di Li <di...@ca.ibm.com> on 2016/04/25 14:18:56 UTC

Review Request 46634: AMBARI-16043: version_builder.py fails to run against Python 2.6

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46634/
-----------------------------------------------------------

Review request for Ambari and Nate Cole.


Bugs: AMBARI-16043
    https://issues.apache.org/jira/browse/AMBARI-16043


Repository: ambari


Description
-------

ersion_builder.py uses the new xpath syntax only supported by ElementTree in Python 2.7 and newer. So running the example.py to invoke version_builder.py to create version XML fails with the following error when Python is version 2.6.x

[root@myserver version-builder]$ python example.py
Traceback (most recent call last):
File "example.py", line 38, in <module>
main(sys.argv)
File "example.py", line 29, in main
vb.add_manifest("HDFS-271", "HDFS", "2.7.1.2.4.0")
File "/home/otto/dev/oss/ambari/trunk/ambari_trunk/contrib/version-builder/version_builder.py", line 122, in add_manifest
service_element = manifest_element.find("./service[@id='
{0}

']".format(id))
File "/usr/lib64/python2.6/xml/etree/ElementTree.py", line 330, in find
return ElementPath.find(self, path)
File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 186, in find
return _compile(path).find(element)
File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 176, in _compile
p = Path(path)
File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 93, in _init_
"expected path separator (%s)" % (op or tag)
SyntaxError: expected path separator ([)


Diffs
-----

  contrib/version-builder/version_builder.py 965d80a 

Diff: https://reviews.apache.org/r/46634/diff/


Testing
-------

generate version XML file on a linux box with only Pyton 2.6 installed, verifies it has the same content as one generated on a linux box with Python 2.7.


Thanks,

Di Li


Re: Review Request 46634: AMBARI-16043: version_builder.py fails to run against Python 2.6

Posted by Nate Cole <nc...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46634/#review130401
-----------------------------------------------------------


Ship it!




Nearly all modern OS are at least 2.7 or 3.0 and surprised any build boxes are on 2.6.

- Nate Cole


On April 25, 2016, 8:18 a.m., Di Li wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46634/
> -----------------------------------------------------------
> 
> (Updated April 25, 2016, 8:18 a.m.)
> 
> 
> Review request for Ambari and Nate Cole.
> 
> 
> Bugs: AMBARI-16043
>     https://issues.apache.org/jira/browse/AMBARI-16043
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> ersion_builder.py uses the new xpath syntax only supported by ElementTree in Python 2.7 and newer. So running the example.py to invoke version_builder.py to create version XML fails with the following error when Python is version 2.6.x
> 
> [root@myserver version-builder]$ python example.py
> Traceback (most recent call last):
> File "example.py", line 38, in <module>
> main(sys.argv)
> File "example.py", line 29, in main
> vb.add_manifest("HDFS-271", "HDFS", "2.7.1.2.4.0")
> File "/home/otto/dev/oss/ambari/trunk/ambari_trunk/contrib/version-builder/version_builder.py", line 122, in add_manifest
> service_element = manifest_element.find("./service[@id='
> {0}
> 
> ']".format(id))
> File "/usr/lib64/python2.6/xml/etree/ElementTree.py", line 330, in find
> return ElementPath.find(self, path)
> File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 186, in find
> return _compile(path).find(element)
> File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 176, in _compile
> p = Path(path)
> File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 93, in _init_
> "expected path separator (%s)" % (op or tag)
> SyntaxError: expected path separator ([)
> 
> 
> Diffs
> -----
> 
>   contrib/version-builder/version_builder.py 965d80a 
> 
> Diff: https://reviews.apache.org/r/46634/diff/
> 
> 
> Testing
> -------
> 
> generate version XML file on a linux box with only Pyton 2.6 installed, verifies it has the same content as one generated on a linux box with Python 2.7.
> 
> 
> Thanks,
> 
> Di Li
> 
>