Fixes 1397570 by 'feature detection'

This commit is contained in:
Phill Ridout 2014-12-05 17:04:44 +00:00
parent 65a10080b4
commit e190bf30e9
1 changed files with 8 additions and 2 deletions

View File

@ -35,6 +35,7 @@ import logging
import locale import locale
import os import os
import re import re
from shutil import which
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
import sys import sys
import urllib.request import urllib.request
@ -406,13 +407,18 @@ def get_uno_command():
""" """
Returns the UNO command to launch an openoffice.org instance. 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' OPTIONS = '--nologo --norestore --minimized --nodefault --nofirststartwizard'
if UNO_CONNECTION_TYPE == 'pipe': if UNO_CONNECTION_TYPE == 'pipe':
CONNECTION = '"--accept=pipe,name=openlp_pipe;urp;"' CONNECTION = '"--accept=pipe,name=openlp_pipe;urp;"'
else: else:
CONNECTION = '"--accept=socket,host=localhost,port=2002;urp;"' 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): def get_uno_instance(resolver):