Comment 5 for bug 867449

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

Well this point is all a story.

Summary of the long debate in short:

-official addons can not embed compiled binary it may make anti viruses angry
-some people want to use a different version of binary than the one in the system for example the QT patched one
-walking path can be costly etc.

So in 6.1 we decided to put it as a server ir_config_parameter. If this data is available it is used else it will look in the path.

"""
    def get_lib(self, cursor, uid):
        """Return the lib wkhtml path"""
        proxy = self.pool.get('ir.config_parameter')
        webkit_path = proxy.get_param(cursor, uid, 'webkit_path')

        if not webkit_path:
            try:
                defpath = os.environ.get('PATH', os.defpath).split(os.pathsep)
                if hasattr(sys, 'frozen'):
                    defpath.append(os.getcwd())
                    if tools.config['root_path']:
                        defpath.append(os.path.dirname(tools.config['root_path']))
                webkit_path = tools.which('wkhtmltopdf', path=os.pathsep.join(defpath))
            except IOError:
                webkit_path = None

        if webkit_path:
            return webkit_path
"""

Your patch is follows the flow that has been taken in 6.1. But I'm not sure it fits 6.0 commit policy.

To offer an alternate way we have coded the webkit_lib addons that embed binary and use the good one depending on OS and architecture (32, 64).

Regards

Nicolas