def qt_plugins_binaries(plugin_type, namespace): """ Return list of dynamic libraries formatted for mod.binaries. :param plugin_type: Plugin to look for :param namespace: Import namespace (PyQt5, PyQt6, PySide2, or PySide6) :return: Plugin directory path corresponding to the given plugin_type """ qt_info = get_qt_library_info(namespace) pdir = qt_plugins_dir(namespace) files = [] for path in pdir: files.extend(misc.dlls_in_dir(os.path.join(path, plugin_type))) # Windows: # # dlls_in_dir() grabs all files ending with ``*.dll``, ``*.so`` and # ``*.dylib`` in a certain directory. On Windows this would grab debug # copies of Qt plugins, which then causes PyInstaller to add a dependency on # the Debug CRT *in addition* to the release CRT. if compat.is_win: files = [f for f in files if not f.endswith("d.dll")] logger.debug("Found plugin files %s for plugin %s", files, plugin_type) dest_dir = os.path.join(qt_info.qt_rel_dir, 'plugins', plugin_type) binaries = [(f, dest_dir) for f in files] return binaries
def qt_plugins_binaries(plugin_type, namespace): """ Return list of dynamic libraries formatted for mod.binaries. :param plugin_type: Plugin to look for :param namespace: Import namespace, i.e., PyQt5 or PySide2 :return: Plugin directory path corresponding to the given plugin_type """ if namespace not in ['PyQt5', 'PySide2']: raise Exception('Invalid namespace: {0}'.format(namespace)) pdir = qt_plugins_dir(namespace=namespace) files = [] for path in pdir: files.extend(misc.dlls_in_dir(os.path.join(path, plugin_type))) # Windows: # # dlls_in_dir() grabs all files ending with ``*.dll``, ``*.so`` and # ``*.dylib`` in a certain directory. On Windows this would grab debug # copies of Qt plugins, which then causes PyInstaller to add a dependency on # the Debug CRT *in addition* to the release CRT. if compat.is_win and namespace in ['PyQt5', 'PySide2']: files = [f for f in files if not f.endswith("d.dll")] logger.debug("Found plugin files %s for plugin %s", files, plugin_type) if namespace == 'PyQt5': plugin_dir = os.path.join('PyQt5', 'Qt', 'plugins') else: plugin_dir = os.path.join('PySide2', 'plugins') dest_dir = os.path.join(plugin_dir, plugin_type) binaries = [(f, dest_dir) for f in files] return binaries
def qt4_plugins_binaries(plugin_type): """Return list of dynamic libraries formatted for mod.pyinstaller_binaries.""" binaries = [] pdir = qt4_plugins_dir() files = misc.dlls_in_dir(os.path.join(pdir, plugin_type)) # Windows: # # dlls_in_dir() grabs all files ending with *.dll, *.so and *.dylib in a certain # directory. On Windows this would grab debug copies of Qt 4 plugins, which then # causes PyInstaller to add a dependency on the Debug CRT __in addition__ to the # release CRT. # # Since debug copies of Qt4 plugins end with "d4.dll" we filter them out of the # list. # if is_win: files = [f for f in files if not f.endswith("d4.dll")] for f in files: binaries.append( ( # TODO fix this hook to use hook-name.py attribute 'binaries'. os.path.join("qt4_plugins", plugin_type, os.path.basename(f)), f, "BINARY", ) ) return binaries
def qt4_plugins_binaries(plugin_type): """Return list of dynamic libraries formatted for mod.pyinstaller_binaries.""" binaries = [] pdir = qt4_plugins_dir() files = misc.dlls_in_dir(os.path.join(pdir, plugin_type)) # Windows: # # dlls_in_dir() grabs all files ending with *.dll, *.so and *.dylib in a certain # directory. On Windows this would grab debug copies of Qt 4 plugins, which then # causes PyInstaller to add a dependency on the Debug CRT __in addition__ to the # release CRT. # # Since debug copies of Qt4 plugins end with "d4.dll" we filter them out of the # list. # if is_win: files = [f for f in files if not f.endswith("d4.dll")] for f in files: binaries.append(( # TODO fix this hook to use hook-name.py attribute 'binaries'. os.path.join('qt4_plugins', plugin_type, os.path.basename(f)), f, 'BINARY')) return binaries
def qt5_plugins_binaries(plugin_type): """Return list of dynamic libraries formatted for mod.pyinstaller_binaries.""" binaries = [] pdir = qt5_plugins_dir() files = misc.dlls_in_dir(os.path.join(pdir, plugin_type)) for f in files: binaries.append((os.path.join("qt5_plugins", plugin_type, os.path.basename(f)), f, "BINARY")) return binaries
def qt4_plugins_binaries(plugin_type): """Return list of dynamic libraries formated for mod.binaries.""" binaries = [] pdir = qt4_plugins_dir() files = misc.dlls_in_dir(os.path.join(pdir, plugin_type)) for f in files: binaries.append((os.path.join('qt4_plugins', plugin_type, os.path.basename(f)), f, 'BINARY')) return binaries
def qt4_plugins_binaries(plugin_type): """Return list of dynamic libraries formated for mod.binaries.""" binaries = [] pdir = qt4_plugins_dir() files = misc.dlls_in_dir(os.path.join(pdir, plugin_type)) for f in files: binaries.append(( os.path.join('qt4_plugins', plugin_type, os.path.basename(f)), f, 'BINARY')) return binaries