Package: libswe-doc
Version: 1.80.00.0001-1
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch vivid

python-uno (the Python 2 version) is AIUI deprecated, and the latest
version of libreoffice in experimental no longer ships it.  The attached
patch ports libswe-doc to python3-uno.  Note that it contains a
conversion of some tabs to spaces, since the previous indentation
provoked a TabError from Python 3.

Thanks,

-- 
Colin Watson                                       [cjwat...@ubuntu.com]
  * Port DocumentConverter.py to Python 3 (LP: #1290037).

diff -Nru libswe-doc-1.80.00.0001/debian/control libswe-doc-1.80.00.0001/debian/control
--- libswe-doc-1.80.00.0001/debian/control	2013-11-05 21:07:46.000000000 +0000
+++ libswe-doc-1.80.00.0001/debian/control	2014-12-10 13:43:57.000000000 +0000
@@ -2,7 +2,7 @@
 Priority: extra
 Maintainer: Paul Elliott <pelli...@blackpatchpanel.com>
 Uploaders: Jaldhar H. Vyas <jald...@debian.org>
-Build-Depends: debhelper (>= 9~), autotools-dev, procps, python-uno, libreoffice-common, libreoffice-writer, libreoffice-java-common, procps
+Build-Depends: debhelper (>= 9~), autotools-dev, procps, python3-uno, libreoffice-common, libreoffice-writer, libreoffice-java-common, procps
 Standards-Version: 3.9.4
 Section: doc
 Homepage: http://swissephauto.blackpatchpanel.com/
diff -Nru libswe-doc-1.80.00.0001/debian/patches/python3.patch libswe-doc-1.80.00.0001/debian/patches/python3.patch
--- libswe-doc-1.80.00.0001/debian/patches/python3.patch	1970-01-01 01:00:00.000000000 +0100
+++ libswe-doc-1.80.00.0001/debian/patches/python3.patch	2014-12-10 14:32:52.000000000 +0000
@@ -0,0 +1,96 @@
+Description: Convert to Python 3
+Author: Colin Watson <cjwat...@ubuntu.com>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1290037
+Forwarded: no
+Last-Update: 2014-12-10
+
+Index: b/iloconvert/DocumentConverter.py
+===================================================================
+--- a/iloconvert/DocumentConverter.py
++++ b/iloconvert/DocumentConverter.py
+@@ -82,7 +82,7 @@
+         try:
+             context = resolver.resolve("uno:socket,host=localhost,port=%s;urp;StarOffice.ComponentContext" % port)
+         except NoConnectException:
+-            raise DocumentConversionException, "failed to connect to OpenOffice.org on port %s" % port
++            raise DocumentConversionException("failed to connect to OpenOffice.org on port %s" % port)
+         self.desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context)
+ 
+     def convert(self, inputFile, outputFile):
+@@ -109,11 +109,11 @@
+         try:
+             filterByFamily = FILTER_MAP[outputExt]
+         except KeyError:
+-            raise DocumentConversionException, "unknown output format: '%s'" % outputExt
++            raise DocumentConversionException("unknown output format: '%s'" % outputExt)
+         try:
+             return filterByFamily[family]
+         except KeyError:
+-            raise DocumentConversionException, "unsupported conversion: from '%s' to '%s'" % (family, outputExt)
++            raise DocumentConversionException("unsupported conversion: from '%s' to '%s'" % (family, outputExt))
+     
+     def _detectFamily(self, document):
+         if document.supportsService("com.sun.star.text.GenericTextDocument"):
+@@ -126,7 +126,7 @@
+             return FAMILY_PRESENTATION
+         if document.supportsService("com.sun.star.drawing.DrawingDocument"):
+             return FAMILY_DRAWING
+-        raise DocumentConversionException, "unknown document family: %s" % document
++        raise DocumentConversionException("unknown document family: %s" % document)
+ 
+     def _getFileExt(self, path):
+         ext = splitext(path)[1]
+@@ -139,10 +139,10 @@
+     def _toProperties(self, **args):
+         props = []
+         for key in args:
+-	    prop = PropertyValue()
+-	    prop.Name = key
+-	    prop.Value = args[key]
+-	    props.append(prop)
++            prop = PropertyValue()
++            prop.Name = key
++            prop.Value = args[key]
++            props.append(prop)
+         return tuple(props)
+ 
+ 
+@@ -150,19 +150,19 @@
+     from sys import argv, exit
+     
+     if len(argv) < 3:
+-        print "USAGE: python %s <input-file> <output-file>" % argv[0]
++        print("USAGE: python %s <input-file> <output-file>" % argv[0])
+         exit(255)
+     if not isfile(argv[1]):
+-        print "no such input file: %s" % argv[1]
++        print("no such input file: %s" % argv[1])
+         exit(1)
+ 
+     try:
+         converter = DocumentConverter()    
+         converter.convert(argv[1], argv[2])
+-    except DocumentConversionException, exception:
+-        print "ERROR!" + str(exception)
++    except DocumentConversionException as exception:
++        print("ERROR!" + str(exception))
+         exit(1)
+-    except ErrorCodeIOException, exception:
+-        print "ERROR! ErrorCodeIOException %d" % exception.ErrCode
++    except ErrorCodeIOException as exception:
++        print("ERROR! ErrorCodeIOException %d" % exception.ErrCode)
+         exit(1)
+ 
+Index: b/iloconvert/loconvert
+===================================================================
+--- a/iloconvert/loconvert
++++ b/iloconvert/loconvert
+@@ -130,7 +130,7 @@
+ # run the tests
+ echo "Do the conversion..."
+ export PYTHONPATH="$ooo_home/basis-link/program"
+-python $document_converter_py "$OOCONV_INPUT" "$OOCONV_OUTPUT"
++python3 $document_converter_py "$OOCONV_INPUT" "$OOCONV_OUTPUT"
+ 
+ # kill the OOo
+ #killall -9 soffice.bin
diff -Nru libswe-doc-1.80.00.0001/debian/patches/series libswe-doc-1.80.00.0001/debian/patches/series
--- libswe-doc-1.80.00.0001/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ libswe-doc-1.80.00.0001/debian/patches/series	2014-12-10 13:41:17.000000000 +0000
@@ -0,0 +1 @@
+python3.patch

Reply via email to