Skip to content

Commit

Permalink
Hooks: Include OpenGL Fallback DLLs for PyQt5. Fixes issue pyinstalle…
Browse files Browse the repository at this point in the history
  • Loading branch information
Siecje committed Jun 13, 2018
1 parent 56ee7e5 commit ec12915
Showing 1 changed file with 31 additions and 12 deletions.
43 changes: 31 additions & 12 deletions PyInstaller/hooks/hook-PyQt5.py
Expand Up @@ -6,6 +6,7 @@
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
import glob
import os

from PyInstaller.utils.hooks import pyqt5_library_info, collect_system_data_files
Expand All @@ -18,16 +19,34 @@
'PyQt5')
if os.path.basename(x[0]) == 'qt.conf']

# Include ICU files, if they exist. See the "Deployment approach" section in
# ``PyInstaller/utils/hooks/qt.py``.
[(os.path.join(pyqt5_library_info.location['BinariesPath'], dll),
os.path.join('PyQt5', 'Qt', 'bin', dll))
for dll in ('icudt??.dll', 'icuin??.dll', 'icuuc??.dll')]
dlls_to_include = [
# TODO: Uncomment when the standard PyQt5 wheel includes d3dcompiler_XX.dll
# 'libEGL.dll', 'libGLESv2.dll', 'd3dcompiler_??.dll', # ANGLE fallback
'opengl32sw.dll', # OpenGL software renderer fallback
'icudt??.dll', 'icuin??.dll', 'icuuc??.dll' # ICU files
# See "Deployment approach" section in ``PyInstaller/utils/hooks/qt.py``
]
binaries = []
for dll in dlls_to_include:
dll_path = os.path.join(pyqt5_library_info.location['BinariesPath'], dll)
dll_file_paths = glob.glob(dll_path)
# Only add files if they exist.
for dll_file_path in dll_file_paths:
file_name = os.path.basename(dll_file_path)
dst_dll_path = os.path.join('PyQt5', 'Qt', 'bin', file_name)
binaries.append((dll_file_path, dst_dll_path))

# TODO: Include software rendering for OpenGL. See the "Deployment approach". However, because the standard PyQt5 wheel `doesn't include <https://www.riverbankcomputing.com/pipermail/pyqt/2018-June/040387.html>`_ ``d3dcompiler_XX.dll``, this produces failures. When the wheel is updated, this code can be uncommented.
##binaries = []
##for dll in ('libEGL.dll', 'libGLESv2.dll', 'd3dcompiler_??.dll', 'opengl32sw.dll'):
## dll_path = os.path.join(pyqt5_library_info.location['BinariesPath'], dll)
## # Only add files if they exist.
## if glob(dll_path):
## binaries += [(dll_path, os.path.join('PyQt5', 'Qt', 'bin', dll))]
# TODO: Once the PyQt5 wheels include d3dcompiler_??.dll remove this
# Only include ANGLE if all files are available, this prevents CI failure
angle_binaries = []
for dll in ('libEGL.dll', 'libGLESv2.dll', 'd3dcompiler_??.dll'):
dll_path = os.path.join(pyqt5_library_info.location['BinariesPath'], dll)
dll_file_paths = glob.glob(dll_path)
# Only add files if they exist.
for dll_file_path in dll_file_paths:
file_name = os.path.basename(dll_file_path)
dst_dll_path = os.path.join('PyQt5', 'Qt', 'bin', file_name)
angle_binaries.append((dll_file_path, dst_dll_path))

if len(angle_binaries) == 3:
binaries += angle_binaries

0 comments on commit ec12915

Please sign in to comment.