from openerp import SUPERUSER_ID
from openerp.exceptions import AccessError
from openerp.osv import osv
-from openerp.tools import config, which
+from openerp.tools import config
+from openerp.tools.misc import find_in_path
from openerp.tools.translate import _
from openerp.addons.web.http import request
from openerp.tools.safe_eval import safe_eval as eval
_logger = logging.getLogger(__name__)
def _get_wkhtmltopdf_bin():
- defpath = os.environ.get('PATH', os.defpath).split(os.pathsep)
- return which('wkhtmltopdf', path=os.pathsep.join(defpath))
+ return find_in_path('wkhtmltopdf')
#--------------------------------------------------------------------------
process = subprocess.Popen(
[_get_wkhtmltopdf_bin(), '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
-except (OSError, IOError):
+except (OSError, IOError, ValueError):
_logger.info('You need Wkhtmltopdf to print a pdf version of the reports.')
else:
_logger.info('Will use the Wkhtmltopdf binary at %s' % _get_wkhtmltopdf_bin())
# We include the *Base ones just in case, currently they seem to be subclasses of the _* ones.
SKIPPED_ELEMENT_TYPES = (etree._Comment, etree._ProcessingInstruction, etree.CommentBase, etree.PIBase)
+DEFAULT_PATH = os.environ.get('PATH', os.defpath).split(os.pathsep)
+if config.get('bin_path'):
+ DEFAULT_PATH.append(config['bin_path'])
+
def find_in_path(name):
try:
- return which(name)
+ return which(name, path=os.pathsep.join(DEFAULT_PATH))
except IOError:
return None
WriteIniStr "$INSTDIR\server\openerp-server.conf" "options" "db_port" $TextPostgreSQLPort\r
# Fix the addons path\r
WriteIniStr "$INSTDIR\server\openerp-server.conf" "options" "addons_path" "$INSTDIR\server\openerp\addons"\r
+ WriteIniStr "$INSTDIR\server\openerp-server.conf" "options" "bin_path" "$INSTDIR\thirdparty"\r
\r
# if we're going to install postgresql force it's path,\r
# otherwise we consider it's always done and/or correctly tune by users\r