From f220d32702eddbd18be167b2742bb60043f60a45 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 5 Aug 2015 19:17:43 -0700 Subject: [bug] workaround wrong qtplugins path rewritten in the libs this is a bug in macholib, there's a missing letter in the plugins path, so unless we fix this they cannot be loaded from the bundle. See: https://bitbucket.org/pydica/pyside-setup/commits/4b8be97e5a00b577fe30ce9aa7e5723ff2a66f94 Quoting from http://code.activestate.com/lists/pythonmac-sig/23278/: """ The problem might be this line: @rpath/Contents/mageformats/libqtiff.dylib The "i" from "imageformats" is missing! This _might_ be related to the unusual case that "libqtiff" has no path at all, or something else is funny, and we end up with a name that will not be found at all. Then the loader finds the plugin in the installed Qt, which causes it to load everything again from there. """ --- src/leap/bitmask/app.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py index be1fc424..a2e2aa1a 100644 --- a/src/leap/bitmask/app.py +++ b/src/leap/bitmask/app.py @@ -60,7 +60,7 @@ from leap.bitmask.frontend_app import run_frontend from leap.bitmask.logs.utils import get_logger from leap.bitmask.platform_init.locks import we_are_the_one_and_only from leap.bitmask.services.mail import plumber -from leap.bitmask.util import leap_argparse, flags_to_dict +from leap.bitmask.util import leap_argparse, flags_to_dict, here from leap.bitmask.util.requirement_checker import check_requirements from leap.mail import __version__ as MAIL_VERSION @@ -68,7 +68,6 @@ from leap.mail import __version__ as MAIL_VERSION import codecs codecs.register(lambda name: codecs.lookup('utf-8') if name == 'cp65001' else None) - import psutil @@ -134,6 +133,15 @@ def log_lsb_release_info(logger): for line in distro_info: logger.info(line) +def fix_qtplugins_path(): + # This is a small workaround for a bug in macholib, there is a slight typo + # in the path for the qt plugins that is added to the dynamic loader path + # in the libs. + if sys.platform in ('win32', 'darwin'): + from PySide import QtCore + plugins_path = os.path.join(os.path.dirname(here(QtCore)), 'plugins') + QtCore.QCoreApplication.setLibraryPaths([plugins_path]) + def start_app(): """ @@ -200,7 +208,6 @@ def start_app(): logger.info('leap.mail version %s' % MAIL_VERSION) log_lsb_release_info(logger) logger.info('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') - logger.info('Starting app') backend_running = BackendProxy().check_online() @@ -220,6 +227,7 @@ def start_app(): backend_process.start() backend_pid = backend_process.pid + fix_qtplugins_path() run_frontend(options, flags_dict, backend_pid=backend_pid) -- cgit v1.2.3