1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-08-05 23:35:48 +03:00

Finish and clean up Python 3 support

- Handle Python 3 types similar to libxml2
- Copy new versions of libxml_xmlXPathDestructNsNode and
  libxml_xmlXPathObjectPtrConvert from libxml2
- Fix compiler warnings
- Fix whitespace
- Remove unneeded imports from __future__
- Remove test in extelem.py (StringIO can't be converted to FILE under
  Python 3)
- string.lower() works in both Python 2 and 3

Closes #25.
This commit is contained in:
Nick Wellnhofer
2020-11-19 16:08:03 +01:00
parent a2db8da1ac
commit b3076bccdb
10 changed files with 230 additions and 284 deletions

View File

@@ -1,15 +1,6 @@
#!/usr/bin/python -u
from __future__ import print_function
import sys
import string
import sys
if sys.version_info < (3, 0):
import StringIO as io
else:
import io
import libxml2
# Memory debug specific
libxml2.debugMemory(1)
@@ -42,7 +33,7 @@ def transform_test(ctx, node, inst, comp):
pass
tctxt.insertNode().addContent('SUCCESS')
styledoc = libxml2.parseDoc("""
@@ -65,14 +56,6 @@ result = style.applyStylesheet(doc, None)
style.freeStylesheet()
doc.freeDoc()
extensions = io.StringIO()
libxslt.debugDumpExtensions(extensions)
if 0 and extensions.buf.find(EXT_URL) < 0:
print("Element extension not registered (or dumping broken)")
sys.exit(1)
root = result.children
if root.name != "article":