Add libxml2 package
This commit is contained in:
55
libxml2/libxml2-2.9.1-python3a.patch
Normal file
55
libxml2/libxml2-2.9.1-python3a.patch
Normal file
@@ -0,0 +1,55 @@
|
||||
From 6dd7775f3506741093890d99f09c242e0b34b55f Mon Sep 17 00:00:00 2001
|
||||
From: Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA@gmail..com>
|
||||
Date: Fri, 12 Jul 2013 11:18:11 +0800
|
||||
Subject: [PATCH] Another round of fixes for older versions of Python
|
||||
|
||||
---
|
||||
python/drv_libxml2.py | 14 ++++++--------
|
||||
1 file changed, 6 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/python/drv_libxml2.py b/python/drv_libxml2.py
|
||||
index c9075e6..c2ec3e2 100644
|
||||
--- a/python/drv_libxml2.py
|
||||
+++ b/python/drv_libxml2.py
|
||||
@@ -40,14 +40,12 @@ __version__ = "0.3"
|
||||
import sys
|
||||
import codecs
|
||||
|
||||
-if sys.version < "3":
|
||||
+if sys.version_info[0] < 3:
|
||||
__author__ = codecs.unicode_escape_decode(__author__)[0]
|
||||
|
||||
- from types import StringType, UnicodeType
|
||||
- StringTypes = (StringType,UnicodeType)
|
||||
-
|
||||
+ StringTypes = (str, unicode)
|
||||
else:
|
||||
- StringTypes = (str)
|
||||
+ StringTypes = str
|
||||
|
||||
from xml.sax._exceptions import *
|
||||
from xml.sax import xmlreader, saxutils
|
||||
@@ -73,9 +71,9 @@ def _d(s):
|
||||
|
||||
try:
|
||||
import libxml2
|
||||
-except ImportError as e:
|
||||
+except ImportError:
|
||||
raise SAXReaderNotAvailable("libxml2 not available: " \
|
||||
- "import error was: %s" % e)
|
||||
+ "import error was: %s" % sys.exc_info()[1])
|
||||
|
||||
class Locator(xmlreader.Locator):
|
||||
"""SAX Locator adapter for libxml2.xmlTextReaderLocator"""
|
||||
@@ -142,7 +140,7 @@ class LibXml2Reader(xmlreader.XMLReader):
|
||||
self.__parsing = 1
|
||||
try:
|
||||
# prepare source and create reader
|
||||
- if type(source) in StringTypes:
|
||||
+ if isinstance(source, StringTypes):
|
||||
reader = libxml2.newTextReaderFilename(source)
|
||||
else:
|
||||
source = saxutils.prepare_input_source(source)
|
||||
--
|
||||
1.8.3.2
|
||||
|
||||
Reference in New Issue
Block a user