← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~phill-ridout/openlp/bug1397570 into lp:openlp

 

Phill has proposed merging lp:~phill-ridout/openlp/bug1397570 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1397570 in OpenLP: "Libre Office no longer works on Fedora 21"
  https://bugs.launchpad.net/openlp/+bug/1397570

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/bug1397570/+merge/243869

Fixes Bug1397570 by detecting which commands are available on the system. Tries "libreoffice" first then falls back to "soffice"
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/bug1397570 into lp:openlp.
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py	2014-10-22 20:47:47 +0000
+++ openlp/core/utils/__init__.py	2014-12-05 21:10:08 +0000
@@ -35,6 +35,7 @@
 import locale
 import os
 import re
+from shutil import which
 from subprocess import Popen, PIPE
 import sys
 import urllib.request
@@ -406,13 +407,18 @@
     """
     Returns the UNO command to launch an openoffice.org instance.
     """
-    COMMAND = 'soffice'
+    for command in ['libreoffice', 'soffice']:
+        if which(command):
+             break
+    else:
+        raise FileNotFoundError('Command not found')
+
     OPTIONS = '--nologo --norestore --minimized --nodefault --nofirststartwizard'
     if UNO_CONNECTION_TYPE == 'pipe':
         CONNECTION = '"--accept=pipe,name=openlp_pipe;urp;"'
     else:
         CONNECTION = '"--accept=socket,host=localhost,port=2002;urp;"'
-    return '%s %s %s' % (COMMAND, OPTIONS, CONNECTION)
+    return '%s %s %s' % (command, OPTIONS, CONNECTION)
 
 
 def get_uno_instance(resolver):


Follow ups