Commit 89d754f2 authored by Gabriel Monnerat's avatar Gabriel Monnerat

rename attributes requested by luke:

  - office_bin_path -> office_binary_path
  - path_dir_run_cloudooo -> working_path


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@37986 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 80bc4448
......@@ -80,17 +80,17 @@ class OpenOffice(Application):
self.request = 0
def loadSettings(self, hostname, port, path_run_dir, display_id,
office_bin_path, uno_path, **kw):
office_binary_path, uno_path, **kw):
"""Method to load the configuratio to control one OpenOffice Instance
Keyword arguments:
office_path -- Full Path of the OOo executable.
e.g office_bin_path='/opt/openoffice.org3/program'
e.g office_binary_path='/opt/openoffice.org3/program'
uno_path -- Full path of the Uno Library
"""
Application.loadSettings(self, hostname, port, path_run_dir, display_id)
setUpUnoEnvironment(uno_path, office_bin_path)
self.office_bin_path = office_bin_path
setUpUnoEnvironment(uno_path, office_binary_path)
self.office_binary_path = office_binary_path
self.uno_path = uno_path
self.process_name = "soffice.bin"
self.document_url = kw.get('document_url', '')
......@@ -114,7 +114,7 @@ class OpenOffice(Application):
if exists(self.path_user_installation):
removeDirectory(self.path_user_installation)
# Create command with all parameters to start the instance
self.command = [join(self.office_bin_path, self._bin_soffice)
self.command = [join(self.office_binary_path, self._bin_soffice)
, '-invisible'
, '-nologo'
, '-nodefault'
......
......@@ -53,7 +53,7 @@ Options:
--document_url=STRING_URL
URL of document to load in OpenOffice
--office_bin_path=STRING_URL
--office_binary_path=STRING_URL
Folder path were is the binary openoffice
--uno_path=STRING_URL
Folter path were is the uno library
......@@ -196,7 +196,7 @@ def main():
try:
opt_list, arg_list = getopt(sys.argv[1:], "h", ["help", "test",
"convert", "getmetadata", "setmetadata",
"uno_path=", "office_bin_path=",
"uno_path=", "office_binary_path=",
"hostname=", "port=", "source_format=",
"document_url=", "destination_format=",
"mimemapper=", "metadata=",
......@@ -217,9 +217,9 @@ def main():
port = arg
elif opt == '--document_url':
document_url = arg
elif opt == '--office_bin_path':
environ['office_bin_path'] = arg
office_bin_path = arg
elif opt == '--office_binary_path':
environ['office_binary_path'] = arg
office_binary_path = arg
elif opt == '--uno_path':
environ['uno_path'] = arg
uno_path = arg
......@@ -241,8 +241,8 @@ def main():
if "uno_path" in locals():
kw['uno_path'] = uno_path
if "office_bin_path" in locals():
kw['office_bin_path'] = office_bin_path
if "office_binary_path" in locals():
kw['office_binary_path'] = office_binary_path
if "unomimemapper_bin" in locals():
kw['unomimemapper_bin'] = unomimemapper_bin
......
......@@ -44,7 +44,7 @@ Options:
--port=STRING OpenOffice Instance port
--office_bin_path=STRING_URL
--office_binary_path=STRING_URL
Folder path were is the binary openoffice
--uno_path=STRING_URL
Folter path were is the uno library
......@@ -94,7 +94,7 @@ def help():
def main():
try:
opt_list, arg_list = getopt(sys.argv[1:], "h", ["help",
"uno_path=", "office_bin_path=",
"uno_path=", "office_binary_path=",
"hostname=", "port="])
except GetoptError, msg:
msg = msg.msg + "\nUse --help or -h"
......@@ -109,8 +109,8 @@ def main():
help()
if opt == "--uno_path":
environ['uno_path'] = arg
elif opt == "--office_bin_path":
environ['office_bin_path'] = arg
elif opt == "--office_binary_path":
environ['office_binary_path'] = arg
elif opt == '--hostname':
hostname = arg
elif opt == "--port":
......
......@@ -47,16 +47,16 @@ def application(global_config, **local_config):
Keyword arguments:
debug_mode -- Mode as the application prints the messages.
e.g debug_mode=logging.DEBUG
path_dir_run_cloudooo -- Full path to create the environment of the processes.
e.g path_dir_run_cloudooo='/var/run/cloudooo'
working_path -- Full path to create the environment of the processes.
e.g working_path='/var/run/cloudooo'
virtual_display_port -- Port to start the Xvfb.
virtual_display_id -- Sets the display.
e.g virtual_display_id='99'
application_hostname -- Sets the host to Xvfb and Openoffice.
virtual_screen -- Use to define the screen to Xvfb
e.g virtual_screen='0'
office_bin_path -- Full Path of the OOo executable.
e.g office_bin_path='/opt/openoffice.org3/program'
office_binary_path -- Full Path of the OOo executable.
e.g office_binary_path='/opt/openoffice.org3/program'
uno_path -- Full path to pyuno library.
e.g uno_path='/opt/openoffice.org/program'
"""
......@@ -64,11 +64,11 @@ def application(global_config, **local_config):
debug_mode = convertStringToBool(local_config.get('debug_mode'))
configureLogger(debug_mode=debug_mode)
# path of directory to run cloudooo
path_dir_run_cloudooo = local_config.get('path_dir_run_cloudooo')
if not path.exists(path_dir_run_cloudooo):
mkdir(path_dir_run_cloudooo)
working_path = local_config.get('working_path')
if not path.exists(working_path):
mkdir(working_path)
# directory to create temporary files
cloudooo_path_tmp_dir = path.join(path_dir_run_cloudooo, 'tmp')
cloudooo_path_tmp_dir = path.join(working_path, 'tmp')
if not path.exists(cloudooo_path_tmp_dir):
mkdir(cloudooo_path_tmp_dir)
# The Xvfb will run in the same local of the OpenOffice
......@@ -77,7 +77,7 @@ def application(global_config, **local_config):
# Before start Xvfb, first loads the configuration
xvfb.loadSettings(application_hostname,
int(local_config.get('virtual_display_port')),
path_dir_run_cloudooo,
working_path,
local_config.get('virtual_display_id'),
virtual_screen=local_config.get('virtual_screen'),
start_timeout=local_config.get('start_timeout'))
......@@ -86,9 +86,9 @@ def application(global_config, **local_config):
# Loading Configuration to start OOo Instance and control it
openoffice.loadSettings(application_hostname,
openoffice_port,
path_dir_run_cloudooo,
working_path,
local_config.get('virtual_display_id'),
local_config.get('office_bin_path'),
local_config.get('office_binary_path'),
local_config.get('uno_path'))
openoffice.start()
......
......@@ -56,14 +56,14 @@ class OOHandler:
source_format)
self.zip = kw.get('zip', False)
self.uno_path = kw.get("uno_path", None)
self.office_bin_path = kw.get("office_bin_path", None)
self.office_binary_path = kw.get("office_binary_path", None)
self.timeout = kw.get("timeout", 600)
self.unoconverter_bin = kw.get('unoconverter_bin', "unoconverter")
self.source_format = source_format
if not self.uno_path:
self.uno_path = environ.get("uno_path")
if not self.office_bin_path:
self.office_bin_path = environ.get("office_bin_path")
if not self.office_binary_path:
self.office_binary_path = environ.get("office_binary_path")
def _getCommand(self, *args, **kw):
"""Transforms all parameters passed in a command"""
......@@ -74,7 +74,7 @@ class OOHandler:
, "-c"
, "'from cloudooo.bin.unoconverter import main;main()'"
, "--uno_path='%s'" % self.uno_path
, "--office_bin_path='%s'" % self.office_bin_path
, "--office_binary_path='%s'" % self.office_binary_path
, "--document_url='%s'" % self.document.getUrl()]
for arg in args:
command_list.insert(3, "'--%s'" % arg)
......
......@@ -43,8 +43,8 @@ class IApplication(Interface):
def loadSettings(hostname,
port,
virtual_display_id,
path_dir_run_cloudooo,
office_bin_path):
working_path,
office_binary_path):
"""Load configuration to control OOo Instances"""
def status():
......
......@@ -96,19 +96,19 @@ class MimeMapper(object):
port -- port to connects by socket
**kw:
uno_path -- full path to uno library
office_bin_path -- full path to openoffice binary
office_binary_path -- full path to openoffice binary
"""
# Filters that has flag in bad_flag_list is ignored.
# XXX - Is not good way to remove unnecessary filters
# XXX - try find a good way to remove filters that are not used for export
bad_flag_list = [65, 94217, 536641, 1572929, 268959937, 524373, 85, 524353]
uno_path = kw.get("uno_path", environ.get('uno_path'))
office_bin_path = kw.get("office_bin_path", environ.get('office_bin_path'))
office_binary_path = kw.get("office_binary_path", environ.get('office_binary_path'))
command = [python_path
, "'-c'"
, "'from cloudooo.bin.unomimemapper import main;main()'"
, "'--uno_path=%s'" % uno_path
, "'--office_bin_path=%s'" % office_bin_path
, "'--office_binary_path=%s'" % office_binary_path
, "'--hostname=%s'" % hostname, "--port=%s" % port]
stdout, stderr = Popen(' '.join(command),
stdout=PIPE,
......
......@@ -30,7 +30,7 @@ from os import environ, putenv
from sys import path
from os.path import exists
def setUpUnoEnvironment(uno_path=None, office_bin_path=None):
def setUpUnoEnvironment(uno_path=None, office_binary_path=None):
"""Set up the environment to use the uno library and connect with the
openoffice by socket"""
if uno_path is not None:
......@@ -38,15 +38,15 @@ def setUpUnoEnvironment(uno_path=None, office_bin_path=None):
else:
uno_path = environ.get('uno_path')
if office_bin_path is not None:
environ['office_bin_path'] = office_bin_path
if office_binary_path is not None:
environ['office_binary_path'] = office_binary_path
else:
office_bin_path = environ.get('office_bin_path')
office_binary_path = environ.get('office_binary_path')
# Add in sys.path the path of pyuno
if uno_path not in path:
path.append(uno_path)
fundamentalrc_file = '%s/fundamentalrc' % office_bin_path
fundamentalrc_file = '%s/fundamentalrc' % office_binary_path
if exists(fundamentalrc_file) and \
not environ.has_key('URE_BOOTSTRAP'):
putenv('URE_BOOTSTRAP','vnd.sun.star.pathname:%s' % fundamentalrc_file)
......
......@@ -25,8 +25,6 @@ enable_memory_monitor = True
# Set the limit in MB
# e.g 1000 = 1 GB, 100 = 100 MB
limit_memory_used = 1000
# Filename that will be used to test the connection with openoffice.
document_name = test.odt
#
## OOFactory Settings
#
......
......@@ -40,9 +40,9 @@ config = ConfigParser()
testcase_path = path.dirname(__file__)
def check_folder(path_dir_run_cloudooo, tmp_dir_path):
if not path.exists(path_dir_run_cloudooo):
mkdir(path_dir_run_cloudooo)
def check_folder(working_path, tmp_dir_path):
if not path.exists(working_path):
mkdir(working_path)
if not path.exists(tmp_dir_path):
mkdir(tmp_dir_path)
......@@ -61,32 +61,32 @@ def startFakeEnvironment(start_openoffice=True, conf_path=None):
conf_path = sys.argv[1]
loadConfig(conf_path)
uno_path = config.get("app:main", "uno_path")
path_dir_run_cloudooo = config.get("app:main", "path_dir_run_cloudooo")
working_path = config.get("app:main", "working_path")
virtual_display_id = int(config.get("app:main", "virtual_display_id"))
virtual_display_port_int = int(config.get("app:main", "virtual_display_port"))
hostname = config.get("server:main", "host")
openoffice_port = int(config.get("app:main", "openoffice_port"))
office_bin_path = config.get("app:main", "office_bin_path")
tmp_dir = path.join(path_dir_run_cloudooo, 'tmp')
check_folder(path_dir_run_cloudooo, tmp_dir)
office_binary_path = config.get("app:main", "office_binary_path")
tmp_dir = path.join(working_path, 'tmp')
check_folder(working_path, tmp_dir)
if not environ.get('uno_path'):
environ['uno_path'] = uno_path
office_bin_path = config.get("app:main", "office_bin_path")
if not environ.get('office_bin_path'):
environ['office_bin_path'] = office_bin_path
office_binary_path = config.get("app:main", "office_binary_path")
if not environ.get('office_binary_path'):
environ['office_binary_path'] = office_binary_path
if uno_path not in sys.path:
sys.path.append(uno_path)
fundamentalrc_file = '%s/fundamentalrc' % office_bin_path
fundamentalrc_file = '%s/fundamentalrc' % office_binary_path
if path.exists(fundamentalrc_file) and \
not environ.has_key('URE_BOOTSTRAP'):
putenv('URE_BOOTSTRAP','vnd.sun.star.pathname:%s' % fundamentalrc_file)
xvfb.loadSettings(hostname,
virtual_display_port_int,
path_dir_run_cloudooo,
working_path,
virtual_display_id,
virtual_screen='1')
xvfb.start()
......@@ -95,15 +95,15 @@ def startFakeEnvironment(start_openoffice=True, conf_path=None):
if start_openoffice:
openoffice.loadSettings(hostname,
openoffice_port,
path_dir_run_cloudooo,
working_path,
virtual_display_id,
office_bin_path,
office_binary_path,
uno_path)
openoffice.start()
openoffice.acquire()
hostname, port = openoffice.getAddress()
kw = dict(uno_path=config.get("app:main", "uno_path"),
office_bin_path=config.get("app:main", "office_bin_path"))
office_binary_path=config.get("app:main", "office_binary_path"))
if not mimemapper.isLoaded():
mimemapper.loadFilterList(hostname, port, **kw)
openoffice.release()
......@@ -127,11 +127,11 @@ class cloudoooTestCase(unittest.TestCase):
self.hostname = config.get("server:main", "host")
self.cloudooo_port = config.get("server:main", "port")
self.openoffice_port = config.get("app:main", "openoffice_port")
self.office_bin_path = config.get("app:main", "office_bin_path")
self.office_binary_path = config.get("app:main", "office_binary_path")
self.python_path = sys.executable
self.path_dir_run_cloudooo = config.get("app:main", "path_dir_run_cloudooo")
self.tmp_url = path.join(self.path_dir_run_cloudooo, "tmp")
check_folder(self.path_dir_run_cloudooo, self.tmp_url)
self.working_path = config.get("app:main", "working_path")
self.tmp_url = path.join(self.working_path, "tmp")
check_folder(self.working_path, self.tmp_url)
self.uno_path = config.get("app:main", "uno_path")
self.virtual_display_id = config.get("app:main", "virtual_display_id")
self.virtual_display_port_int = config.get("app:main", "virtual_display_port")
......
......@@ -39,9 +39,9 @@ class TestOpenOffice(cloudoooTestCase):
"""Instantiate one OpenOffice"""
self.openoffice = OpenOffice()
self.openoffice.loadSettings("localhost", 4090,
self.path_dir_run_cloudooo,
self.working_path,
self.virtual_display_id,
self.office_bin_path,
self.office_binary_path,
self.uno_path,
openoffice_tester_bin=self.openoffice_tester_bin)
self.openoffice.start()
......
......@@ -60,7 +60,7 @@ class TestUnoConverter(cloudoooTestCase):
"'from cloudooo.bin.unoconverter import main;main()'",
"'--convert'",
"'--uno_path=%s'" % self.uno_path,
"'--office_bin_path=%s'" % self.office_bin_path,
"'--office_binary_path=%s'" % self.office_binary_path,
"'--hostname=%s'" % self.hostname,
"'--port=%s'" % self.port,
"'--document_url=%s'" % self.document.getUrl(),
......@@ -89,7 +89,7 @@ class TestUnoConverter(cloudoooTestCase):
"'from cloudooo.bin.unoconverter import main;main()'",
"'--convert'",
"'--uno_path=%s'" % self.uno_path,
"'--office_bin_path=%s'" % self.office_bin_path,
"'--office_binary_path=%s'" % self.office_binary_path,
"'--hostname=%s'" % self.hostname,
"'--port=%s'" % self.port,
"'--document_url=%s'" % self.document.getUrl(),
......
......@@ -38,13 +38,13 @@ class TestUnoMimeMapper(cloudoooTestCase):
def afterSetUp(self):
""" """
environ['uno_path'] = ''
environ['office_bin_path'] = ''
environ['office_binary_path'] = ''
openoffice.acquire()
def tearDown(self):
""" """
environ['uno_path'] = self.uno_path
environ['office_bin_path'] = self.office_bin_path
environ['office_binary_path'] = self.office_binary_path
openoffice.release()
def testCreateLocalAttributes(self):
......@@ -54,7 +54,7 @@ class TestUnoMimeMapper(cloudoooTestCase):
"-c",
"'from cloudooo.bin.unomimemapper import main; main()'",
"'--uno_path=%s'" % self.uno_path,
"'--office_bin_path=%s'" % self.uno_path,
"'--office_binary_path=%s'" % self.uno_path,
"'--hostname=%s'" % self.hostname,
"'--port=%s'" % self.openoffice_port]
stdout, stderr = Popen(' '.join(command), shell=True,
......@@ -69,7 +69,7 @@ class TestUnoMimeMapper(cloudoooTestCase):
self.assertEquals(stderr, '')
def testCallUnoMimemapperWithoutSomeParameters(self):
""" Test call unomimemapper without uno_path and office_bin_path"""
""" Test call unomimemapper without uno_path and office_binary_path"""
hostname, host = openoffice.getAddress()
command = [self.python_path,
"-c",
......@@ -90,7 +90,7 @@ class TestUnoMimeMapper(cloudoooTestCase):
"-c",
"'from cloudooo.bin.unomimemapper import main; main()'",
"'--uno_path=%s'" % self.uno_path,
"'--office_bin_path=%s'" % self.uno_path,
"'--office_binary_path=%s'" % self.uno_path,
"'--hostname=%s'" % self.hostname,
"'--port=%s'" % self.openoffice_port]
stdout, stderr = Popen(' '.join(command), shell=True,
......
......@@ -38,7 +38,7 @@ class TestXvfb(cloudoooTestCase):
self.xvfb = Xvfb()
self.xvfb.loadSettings(self.hostname,
int(self.virtual_display_port_int),
self.path_dir_run_cloudooo,
self.working_path,
self.virtual_display_id,
virtual_screen='1')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment