blob: 5c4e83da0c10c6f0684fe703674a5be8522c4a30 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
From 927faac6113b625a9a3423eef8f144fc7d9a8547 Mon Sep 17 00:00:00 2001
From: Alexandre Rostovtsev <tetromino@gentoo.org>
Date: Wed, 10 Jul 2013 23:00:54 -0400
Subject: [PATCH] python: fix drv_libxml2.py for python3 compatibility
https://bugzilla.gnome.org/show_bug.cgi?id=703979
---
python/drv_libxml2.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/python/drv_libxml2.py b/python/drv_libxml2.py
index e43fb1d..c9075e6 100644
--- a/python/drv_libxml2.py
+++ b/python/drv_libxml2.py
@@ -34,12 +34,20 @@ TODO
"""
-__author__ = u"St�phane Bidoul <sbi@skynet.be>"
+__author__ = "St�phane Bidoul <sbi@skynet.be>"
__version__ = "0.3"
+import sys
import codecs
-from types import StringType, UnicodeType
-StringTypes = (StringType,UnicodeType)
+
+if sys.version < "3":
+ __author__ = codecs.unicode_escape_decode(__author__)[0]
+
+ from types import StringType, UnicodeType
+ StringTypes = (StringType,UnicodeType)
+
+else:
+ StringTypes = (str)
from xml.sax._exceptions import *
from xml.sax import xmlreader, saxutils
@@ -65,7 +73,7 @@ def _d(s):
try:
import libxml2
-except ImportError, e:
+except ImportError as e:
raise SAXReaderNotAvailable("libxml2 not available: " \
"import error was: %s" % e)
--
1.8.3.2
|