From 896370eaad6298f198020cceca1deb09cc6fc36b Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Sun, 30 Dec 2012 21:45:21 +0100 Subject: [PATCH] Add runtime hook for PyInstaller to set sip API v2. --- pyinstaller-hooks/rthook_openlp_pyqt4.py | 50 ++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 pyinstaller-hooks/rthook_openlp_pyqt4.py diff --git a/pyinstaller-hooks/rthook_openlp_pyqt4.py b/pyinstaller-hooks/rthook_openlp_pyqt4.py new file mode 100644 index 0000000..9120446 --- /dev/null +++ b/pyinstaller-hooks/rthook_openlp_pyqt4.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, # +# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. # +# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # +# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # +# Frode Woldsund, Martin Zibricky, Patrick Zimmermann # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + + +# PyQt4 supports two different APIs: version 1 (default on Python 2) and +# version 2 (default on Python 3). For OpenLP we want to use the version 2 API +# with Python 2. +# +# The v2 API has to be set before any import of PyQt4 modules. +# However, the executable created by PyInstaller overrides qt_plugins directory +# (it uses PyQt4) before any code from OpenLP gets executed. +# +# The following code is bundled with the created executable and executed +# before any other code. + +import sip + +sip.setapi(u'QDate', 2) +sip.setapi(u'QDateTime', 2) +sip.setapi(u'QString', 2) +sip.setapi(u'QTextStream', 2) +sip.setapi(u'QTime', 2) +sip.setapi(u'QUrl', 2) +sip.setapi(u'QVariant', 2)