[merge] python 2.5 fixes

John Arbash Meinel john at arbash-meinel.com
Thu Sep 28 17:08:26 BST 2006


Martin Pool wrote:
> On 27 Sep 2006, John Arbash Meinel <john at arbash-meinel.com> wrote:
>> You have my +1 to changing the import code.
> 
> OK, here's what I'm going to put in:
> 
> 
> === modified file 'bzrlib/xml_serializer.py'
> --- bzrlib/xml_serializer.py	2006-09-22 00:51:36 +0000
> +++ bzrlib/xml_serializer.py	2006-09-28 05:36:24 +0000
> @@ -25,13 +25,20 @@
>  from bzrlib.trace import mutter, warning
>  
>  try:
> -    from cElementTree import (ElementTree, SubElement, Element,
> -                              XMLTreeBuilder, fromstring, tostring)
> -    import elementtree
> +    try:
> +        # it's in this package in python2.5
> +        from xml.etree.cElementTree import (ElementTree, SubElement, Element,
> +            XMLTreeBuilder, fromstring, tostring)
> +        import xml.etree as elementtree
> +    except ImportError:
> +        from cElementTree import (ElementTree, SubElement, Element,
> +                                  XMLTreeBuilder, fromstring, tostring)
> +        import elementtree
>      ParseError = SyntaxError
>  except ImportError:
>      mutter('WARNING: using slower ElementTree; consider installing cElementTree'
>             " and make sure it's on your PYTHONPATH")
> +    # this copy is shipped with bzr
>      from util.elementtree.ElementTree import (ElementTree, SubElement,
>                                                Element, XMLTreeBuilder,
>                                                fromstring, tostring)

I saw it was already merged, which is fine. But shouldn't it be:

from bzrlib.util.elementtree.ElementTree ?

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060928/d24a186e/attachment.pgp 


More information about the bazaar mailing list