mirror of
https://github.com/kennethreitz-archive/pyinstaller.git
synced 2026-06-05 23:50:17 +00:00
Improve PyQt4 import hook to automatically bundle required plugins.
git-svn-id: http://svn.pyinstaller.org/trunk@614 8dd32b29-ccff-0310-8a9a-9233e24343b1
This commit is contained in:
@@ -1,2 +1,11 @@
|
||||
hiddenimports = ['sip', "PyQt4._qt"]
|
||||
|
||||
from hooks.hookutils import qt4_plugins_dir
|
||||
pdir = qt4_plugins_dir()
|
||||
|
||||
datas = [
|
||||
(pdir + "/codecs/*.so", "qt4_plugins/codecs"),
|
||||
(pdir + "/codecs/*.dll", "qt4_plugins/codecs"),
|
||||
(pdir + "/codecs/*.dylib", "qt4_plugins/codecs"),
|
||||
]
|
||||
|
||||
|
||||
@@ -1 +1,19 @@
|
||||
hiddenimports = ['sip', 'PyQt4.QtCore', 'PyQt4._qt']
|
||||
|
||||
from hooks.hookutils import qt4_plugins_dir
|
||||
pdir = qt4_plugins_dir()
|
||||
|
||||
datas = [
|
||||
(pdir + "/imageformats/*.so", "qt4_plugins/imageformats"),
|
||||
(pdir + "/imageformats/*.dll", "qt4_plugins/imageformats"),
|
||||
(pdir + "/imageformats/*.dylib", "qt4_plugins/imageformats"),
|
||||
|
||||
(pdir + "/iconengines/*.so", "qt4_plugins/iconengines"),
|
||||
(pdir + "/iconengines/*.dll", "qt4_plugins/iconengines"),
|
||||
(pdir + "/iconengines/*.dylib", "qt4_plugins/iconengines"),
|
||||
|
||||
(pdir + "/accessible/*.so", "qt4_plugins/accessible"),
|
||||
(pdir + "/accessible/*.dll", "qt4_plugins/accessible"),
|
||||
(pdir + "/accessible/*.dylib", "qt4_plugins/accessible"),
|
||||
]
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
hiddenimports = ['sip', 'PyQt4.QtCore', 'PyQt4._qt']
|
||||
|
||||
from hooks.hookutils import qt4_plugins_dir
|
||||
pdir = qt4_plugins_dir()
|
||||
|
||||
datas = [
|
||||
(pdir + "/script/*.so", "qt4_plugins/script"),
|
||||
(pdir + "/script/*.dll", "qt4_plugins/script"),
|
||||
(pdir + "/script/*.dylib", "qt4_plugins/script"),
|
||||
]
|
||||
|
||||
@@ -1,2 +1,11 @@
|
||||
hiddenimports = ['sip', 'PyQt4.QtCore', 'PyQt4.QtGui', 'PyQt4._qt']
|
||||
|
||||
from hooks.hookutils import qt4_plugins_dir
|
||||
pdir = qt4_plugins_dir()
|
||||
|
||||
datas = [
|
||||
(pdir + "/sqldrivers/*.so", "qt4_plugins/sqldrivers"),
|
||||
(pdir + "/sqldrivers/*.dll", "qt4_plugins/sqldrivers"),
|
||||
(pdir + "/sqldrivers/*.dylib", "qt4_plugins/sqldrivers"),
|
||||
]
|
||||
|
||||
|
||||
@@ -20,3 +20,7 @@ def exec_statement(stat):
|
||||
txt = open(fnm, 'r').read()[:-1]
|
||||
os.remove(fnm)
|
||||
return txt
|
||||
|
||||
def qt4_plugins_dir():
|
||||
return exec_statement("from PyQt4.QtCore import QLibraryInfo; print QLibraryInfo.location(QLibraryInfo.PluginsPath)")
|
||||
|
||||
|
||||
@@ -3,4 +3,5 @@
|
||||
'pywintypes': ['support/rthooks/versioneddll.py'],
|
||||
'win32com': ['support/rthooks/win32comgenpy.py'],
|
||||
'OpenGL': ['support/rthooks/opengl.py'],
|
||||
'PyQt4': ['support/rthooks/qt4plugins.py'],
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# Qt4 plugins are bundled as data files (see hooks/hook-PyQt4*),
|
||||
# within a "qt4_plugins" directory.
|
||||
# We add a runtime hook to tell Qt4 where to find them,
|
||||
# through an environment variable.
|
||||
import os
|
||||
d = "qt4_plugins"
|
||||
if "_MEIPASS2" in os.environ:
|
||||
d = os.path.join(os.environ["_MEIPASS2"], d)
|
||||
os.environ["QT_PLUGIN_PATH"] = d + os.pathsep + os.environ.get("QT_PLUGIN_PATH", "")
|
||||
|
||||
Reference in New Issue
Block a user