From 782010fc1927d18dfb6726f3fe01328fe2c543f9 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Tue, 20 Oct 2020 14:42:58 +0300 Subject: [PATCH] Changes for PyInstaller to build with qtpy and PyQt4 --- packages/pyinstaller/bitmessagemain.spec | 18 +++++++++++++----- .../hooks/pyinstaller_rthook_pyqt4.py | 10 ++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 packages/pyinstaller/hooks/pyinstaller_rthook_pyqt4.py diff --git a/packages/pyinstaller/bitmessagemain.spec b/packages/pyinstaller/bitmessagemain.spec index d7d4d70d..739d0424 100644 --- a/packages/pyinstaller/bitmessagemain.spec +++ b/packages/pyinstaller/bitmessagemain.spec @@ -37,8 +37,17 @@ a = Analysis( 'setuptools.msvc', '_cffi_backend', 'plugins.menu_qrcode', 'plugins.proxyconfig_stem' ], - runtime_hooks=[os.path.join(hookspath, 'pyinstaller_rthook_plugins.py')], - excludes=['bsddb', 'bz2', 'tcl', 'tk', 'Tkinter', 'tests'] + # https://github.com/pyinstaller/pyinstaller/wiki/Recipe-PyQt4-API-Version + runtime_hooks=[ + os.path.join(hookspath, hook) for hook in ( + 'pyinstaller_rthook_pyqt4.py', + 'pyinstaller_rthook_plugins.py' + )], + excludes=[ + 'bsddb', 'bz2', + 'PyQt4.QtOpenGL', 'PyQt4.QtOpenGL', 'PyQt4.QtSql', + 'PyQt4.QtSvg', 'PyQt4.QtTest', 'PyQt4.QtWebKit', 'PyQt4.QtXml', + 'tcl', 'tk', 'Tkinter', 'win32ui', 'tests'] ) @@ -77,9 +86,8 @@ a.datas += addTranslations() excluded_binaries = [ - 'QtOpenGL4.dll', - 'QtSvg4.dll', - 'QtXml4.dll', + 'QtOpenGL4.dll', 'QtSql4.dll', 'QtSvg4.dll', 'QtTest4.dll', + 'QtWebKit4.dll', 'QtXml4.dll' ] a.binaries = TOC([x for x in a.binaries if x[0] not in excluded_binaries]) diff --git a/packages/pyinstaller/hooks/pyinstaller_rthook_pyqt4.py b/packages/pyinstaller/hooks/pyinstaller_rthook_pyqt4.py new file mode 100644 index 00000000..b30fb1cc --- /dev/null +++ b/packages/pyinstaller/hooks/pyinstaller_rthook_pyqt4.py @@ -0,0 +1,10 @@ +# https://github.com/pyinstaller/pyinstaller/wiki/Recipe-PyQt4-API-Version +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)