[svn] r5424 - trunk/tools/unoconv
packagers at lists.rpmforge.net
packagers at lists.rpmforge.net
Sun May 20 13:53:09 CEST 2007
Author: dag
Date: 2007-05-20 13:53:08 +0200 (Sun, 20 May 2007)
New Revision: 5424
Modified:
trunk/tools/unoconv/ChangeLog
trunk/tools/unoconv/unoconv
Log:
Gentoo compatibility, proper error, long options.
Modified: trunk/tools/unoconv/ChangeLog
===================================================================
--- trunk/tools/unoconv/ChangeLog 2007-05-20 04:05:02 UTC (rev 5423)
+++ trunk/tools/unoconv/ChangeLog 2007-05-20 11:53:08 UTC (rev 5424)
@@ -2,6 +2,9 @@
- Added support for almost 100 graphics, presentation and spreadsheet documents
- Added -t/--type option to specify the document type
- Added -v/--verbose to show more information
+- Added Gentoo oofice path '/usr/lib/openoffice/program/' (Peter Draho)
+- Show proper error when file does not exist (Peter Draho)
+- Make long options work :)
* 0.1 - released 19/05/2007
- Initial release
Modified: trunk/tools/unoconv/unoconv
===================================================================
--- trunk/tools/unoconv/unoconv 2007-05-20 04:05:02 UTC (rev 5423)
+++ trunk/tools/unoconv/unoconv 2007-05-20 11:53:08 UTC (rev 5424)
@@ -19,7 +19,7 @@
try:
import uno
except:
- extrapaths = ('/usr/lib/openoffice.org2.0/program/',)
+ extrapaths = ('/usr/lib/openoffice/program/', '/usr/lib/openoffice.org2.0/program/')
for path in extrapaths:
if os.path.isfile(os.path.join(path, 'pyuno.so')):
sys.path.append(path)
@@ -242,7 +242,7 @@
try:
opts, args = getopt.getopt (args, 'c:e:f:hlst:v',
- ['connection:', 'extension:', 'format:', 'help', 'list', 'stdout', 'type:', 'verbose', 'version'] )
+ ['connection=', 'extension=', 'format=', 'help', 'list', 'stdout', 'type=', 'verbose', 'version'] )
except getopt.error, exc:
print >>sys.stderr, 'unoconv: %s, try unoconv -h for a list of all the options' % str(exc)
sys.exit(1)
@@ -304,7 +304,8 @@
type = 'spreadsheet'
if not args:
- print >>sys.stderr, 'You have to provide a file to convert.'
+ print >>sys.stderr, 'unoconv: you have to provide a filename as argument'
+ print >>sys.stderr, 'Try `unoconv -h\' for more information.'
sys.exit(1)
if type:
@@ -322,8 +323,8 @@
outputfmt = outputfmt[0]
if verbose > 0:
print >>sys.stderr, 'Selected format: %s [.%s]' % (outputfmt.summary, outputfmt.extension)
- print >>sys.stderr, 'OpenOffice filter: %s' % (outputfmt.filter)
- print >>sys.stderr, 'Select file type:', outputfmt.type
+ print >>sys.stderr, 'Selected filter: %s' % (outputfmt.filter)
+ print >>sys.stderr, 'Used doctype:', outputfmt.type
rc = 0
doc = None
@@ -354,6 +355,11 @@
if verbose > 0:
print >>sys.stderr, 'Input file:', inputfn
+ if not os.path.exists(inputfn):
+ print >>sys.stderr, 'unoconv: file `%s\' does not exist.' % inputfn
+ rc = 1
+ continue
+
inputurl = unohelper.absolutize(cwd, unohelper.systemPathToFileUrl(inputfn))
doc = desktop.loadComponentFromURL( inputurl , "_blank", 0, inputprops )
@@ -371,25 +377,25 @@
doc.storeToURL("private:stream", outputprops)
except IOException, e:
- print >>sys.stderr, "Error during conversion: %s" % e.Message
+ print >>sys.stderr, "unoconv: error during conversion: %s" % e.Message
sys.exit(1)
except CannotConvertException, e:
- print >>sys.stderr, "Convert error: %s" % e.Message
+ print >>sys.stderr, "unoconv: convert error: %s" % e.Message
except UnoException, e:
- print >>sys.stderr, "Error (%s) during conversion: %s" % (repr(e.__class__), e.Message)
+ print >>sys.stderr, "unoconv: error (%s) during conversion: %s" % (repr(e.__class__), e.Message)
rc = 1
if doc:
doc.dispose()
except NoConnectException, e:
- print >>sys.stderr, "Error: Could not find an existing connection to Open Office at %s:%s." % (server, port)
+ print >>sys.stderr, "unoconv: could not find an existing connection to Open Office at %s:%s." % (server, port)
print >>sys.stderr, "Please start an ooffice instance by doing:\n ooffice -headless -accept=\"socket,host=%s,port=%s;urp;\"" % (server, port)
sys.exit(1)
except UnoException, e:
- print >>sys.stderr, "Error (%s) : %s" % (repr(e.__class__), e.Message)
+ print >>sys.stderr, "unoconv: error (%s) : %s" % (repr(e.__class__), e.Message)
sys.exit(1)
sys.exit(rc)
More information about the svn-commits
mailing list