Commit da17c136 authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor function that starts cloudooo application to check if temporary...

refactor function that starts cloudooo application to check if temporary folder exists. And remove function that clean one directory, because it is very dangerous.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@37821 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b9b9ce09
...@@ -31,7 +31,7 @@ from application.openoffice import openoffice ...@@ -31,7 +31,7 @@ from application.openoffice import openoffice
from application.xvfb import xvfb from application.xvfb import xvfb
from wsgixmlrpcapplication import WSGIXMLRPCApplication from wsgixmlrpcapplication import WSGIXMLRPCApplication
from utils import convertStringToBool, configureLogger, cleanDirectory from utils import convertStringToBool, configureLogger, cleanDirectory
from os import path from os import path, mkdir
from sys import executable from sys import executable
from mimemapper import mimemapper from mimemapper import mimemapper
import monitor, gc, pkg_resources import monitor, gc, pkg_resources
...@@ -69,11 +69,13 @@ def application(global_config, **local_config): ...@@ -69,11 +69,13 @@ def application(global_config, **local_config):
configureLogger(debug_mode=debug_mode) configureLogger(debug_mode=debug_mode)
# path of directory to run cloudooo # path of directory to run cloudooo
path_dir_run_cloudooo = local_config.get('path_dir_run_cloudooo') path_dir_run_cloudooo = local_config.get('path_dir_run_cloudooo')
cleanDirectory(path_dir_run_cloudooo, ignore_list=["tmp",]) if not path.exists(path_dir_run_cloudooo):
mkdir(path_dir_run_cloudooo)
# directory to create temporary files # directory to create temporary files
cloudooo_path_tmp_dir = path.join(path_dir_run_cloudooo, 'tmp') cloudooo_path_tmp_dir = path.join(path_dir_run_cloudooo, 'tmp')
cleanDirectory(cloudooo_path_tmp_dir) if not path.exists(cloudooo_path_tmp_dir):
# it extracts the path of cloudooo scripts mkdir(cloudooo_path_tmp_dir)
# it extracts the path of cloudooo scripts from pkg_resources
cloudooo_resources = pkg_resources.get_distribution('cloudooo') cloudooo_resources = pkg_resources.get_distribution('cloudooo')
console_scripts = cloudooo_resources.get_entry_map()['console_scripts'] console_scripts = cloudooo_resources.get_entry_map()['console_scripts']
unomimemapper_bin = path.join(path.dirname(executable), unomimemapper_bin = path.join(path.dirname(executable),
......
...@@ -43,22 +43,6 @@ def removeDirectory(path): ...@@ -43,22 +43,6 @@ def removeDirectory(path):
except OSError, msg: except OSError, msg:
logger.error(msg) logger.error(msg)
def cleanDirectory(path, ignore_list=[]):
"""Cleans directory.
Keyword arguments:
path -- folder path
"""
if not exists(path):
return
folder_list = [join(path, name) for name in listdir(path)]
ignore_list = [join(path, name) for name in ignore_list]
for path in folder_list:
if isdir(path) and path not in ignore_list:
removeDirectory(path)
else:
logger.debug("%s is not a folder or was ignored" % path)
def socketStatus(hostname, port): def socketStatus(hostname, port):
"""Verify if the address is busy.""" """Verify if the address is busy."""
try: try:
......
from setuptools import setup, find_packages from setuptools import setup, find_packages
version = '1.0.4' version = '1.0.5'
setup(name='cloudooo', setup(name='cloudooo',
version=version, version=version,
description="XML-RPC openoffice document convertion server", description="XML-RPC openoffice document convertion server",
long_description=open("README").read(), long_description=open("./cloudooo/README").read(),
classifiers=["Topic :: System :: Networking", classifiers=["Topic :: System :: Networking",
"Topic :: System :: Operating System Kernels :: Linux", "Topic :: System :: Operating System Kernels :: Linux",
"Topic :: Internet :: WWW/HTTP :: WSGI", "Topic :: Internet :: WWW/HTTP :: WSGI",
......
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