components/libxml2/patches/python34.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 27 Oct 2014 18:46:06 -0700
changeset 2176 18d982113fd0
parent 2032 916ced318d1e
permissions -rw-r--r--
backout 19875486/19875570 - introduces 19897311
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2032
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     1
# This patch has been submitted upstream but not yet accepted:
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     2
# https://bugzilla.gnome.org/show_bug.cgi?id=734005
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     3
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     4
--- libxml2-2.9.1/python/drv_libxml2.py.~1~	2009-07-30 08:24:34.000000000 -0700
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     5
+++ libxml2-2.9.1/python/drv_libxml2.py	2014-07-30 10:43:36.655237802 -0700
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     6
@@ -38,8 +38,11 @@
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     7
 __version__ = "0.3"
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     8
 
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     9
 import codecs
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    10
-from types import StringType, UnicodeType
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    11
-StringTypes = (StringType,UnicodeType)
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    12
+try:
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    13
+    from types import StringType, UnicodeType
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    14
+    StringTypes = (StringType,UnicodeType)
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    15
+except:
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    16
+    StringTypes = (bytes,str)
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    17
 
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    18
 from xml.sax._exceptions import *
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    19
 from xml.sax import xmlreader, saxutils
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    20
@@ -65,7 +68,7 @@
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    21
 
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    22
 try:
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    23
     import libxml2
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    24
-except ImportError, e:
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    25
+except ImportError as e:
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    26
     raise SAXReaderNotAvailable("libxml2 not available: " \
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    27
                                 "import error was: %s" % e)
916ced318d1e 19317151 libxml2 needs Python 3 module
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    28