File opendict-no-xml-dom-ext.patch of Package opendict

#!/bin/sh
# Patch created by:
quilt new opendict-no-xml-dom-ext.patch
quilt add *.py */*.py */*/*.py */*/*/*.py
sed -i '/import xml.dom.ext/d' *.py */*.py */*/*.py */*/*/*.py
sed -i 's/xml.dom.ext.PrettyPrint\( *\)(\([^),]*\), *\([^)]*\))/\3.write\1(\2.toxml\1())/' *.py */*.py */*/*.py */*/*/*.py
quilt refresh
echo "Please remove orphan \"try:\" and \"ImportError\" section in opendict.py and \"call quilt refresh\"."
exit

Index: opendict-0.6.3/lib/xmltools.py
===================================================================
--- opendict-0.6.3.orig/lib/xmltools.py
+++ opendict-0.6.3/lib/xmltools.py
@@ -20,7 +20,6 @@
 #
 
 import xml.dom.minidom
-import xml.dom.ext
 
 from lib import meta
 
@@ -114,7 +113,7 @@ def writePlainDictConfig(doc, path):
     """Write XML file"""
 
     fd = open(path, 'w')
-    xml.dom.ext.PrettyPrint(doc, fd)
+    fd.write(doc.toxml())
     fd.close()
     
 
@@ -242,7 +241,7 @@ def writeIndexFile(doc, path):
     """Write XML file"""
 
     fd = open(path, 'wb')
-    xml.dom.ext.PrettyPrint(doc, fd)
+    fd.write(doc.toxml())
     fd.close()
 
 
@@ -512,6 +511,6 @@ def writeConfig(doc, path):
     """Write XML file"""
 
     fd = open(path, 'w')
-    xml.dom.ext.PrettyPrint(doc, fd)
+    fd.write(doc.toxml())
     fd.close()
 
Index: opendict-0.6.3/misc/repository/make-addons-list.py
===================================================================
--- opendict-0.6.3.orig/misc/repository/make-addons-list.py
+++ opendict-0.6.3/misc/repository/make-addons-list.py
@@ -5,7 +5,6 @@ import os
 import zipfile
 import md5
 import xml.dom.minidom
-import xml.dom.ext
 
 #
 # Add-ons description file generator for OpenDict
@@ -268,7 +267,7 @@ def main():
 
     doc = makeDocument(xmlElements)
     fd = open('opendict-add-ons.xml', 'w')
-    xml.dom.ext.PrettyPrint(doc, fd)
+    fd.write(doc.toxml())
     fd.close()
     
 
Index: opendict-0.6.3/opendict.py
===================================================================
--- opendict-0.6.3.orig/opendict.py
+++ opendict-0.6.3/opendict.py
@@ -54,15 +54,6 @@ except ImportError:
     sys.exit(1)
 
 
-try:
-    import xml.dom.ext
-except ImportError:
-    print >> sys.stderr, "**"
-    print >> sys.stderr, "** Error: Python/XML library not found"
-    print >> sys.stderr, "** Please install python-xml (PyXML) to run OpenDict"
-    print >> sys.stderr, "**"
-    sys.exit(1)
-
 # get_main_dir() returns the directory name of the script or the
 # directory name of the exe
 def get_main_dir():
Index: opendict-0.6.3/scripts/make-addons-list.py
===================================================================
--- opendict-0.6.3.orig/scripts/make-addons-list.py
+++ opendict-0.6.3/scripts/make-addons-list.py
@@ -5,7 +5,6 @@ import os
 import zipfile
 import md5
 import xml.dom.minidom
-import xml.dom.ext
 
 #
 # Add-ons description file generator for OpenDict
@@ -267,7 +266,7 @@ def main():
 
     doc = makeDocument(xmlElements)
     fd = open('opendict-add-ons.xml', 'w')
-    xml.dom.ext.PrettyPrint(doc, fd)
+    fd.write(doc.toxml())
     fd.close()
     
 
openSUSE Build Service is sponsored by