From 3434a40c35e008865a9b4e20ee70c118f2ffcf72 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 8 Jun 2019 10:48:21 +0530 Subject: [PATCH] Move Qt DLL list into this codebase from bypy --- bypy/init_env.py | 84 +++++++++++++++++++++++++++++++++++++++++- bypy/linux/__main__.py | 7 ++-- bypy/macos/__main__.py | 7 ++-- 3 files changed, 91 insertions(+), 7 deletions(-) diff --git a/bypy/init_env.py b/bypy/init_env.py index e32263389e..e87adf6511 100644 --- a/bypy/init_env.py +++ b/bypy/init_env.py @@ -11,11 +11,93 @@ import subprocess import sys from bypy.constants import ( - LIBDIR, PREFIX, PYTHON, SRC as CALIBRE_DIR, build_dir, worker_env + LIBDIR, PREFIX, PYTHON, SRC as CALIBRE_DIR, build_dir, islinux, ismacos, + worker_env ) from bypy.utils import run_shell +dlls = [ + 'Core', + 'Concurrent', + 'Gui', + 'Network', + # 'NetworkAuth', + 'Location', + 'PrintSupport', + 'WebChannel', + # 'WebSockets', + # 'WebView', + 'Positioning', + 'Sensors', + 'Sql', + 'Svg', + 'WebKit', + 'WebKitWidgets', + 'WebEngineCore', + 'WebEngine', + 'WebEngineWidgets', + 'Widgets', + # 'Multimedia', + 'OpenGL', + # 'MultimediaWidgets', + 'Xml', + # 'XmlPatterns', +] + +if islinux: + dlls += ['X11Extras', 'XcbQpa', 'WaylandClient', 'DBus'] +elif ismacos: + dlls += ['MacExtras', 'DBus'] + +QT_DLLS = frozenset( + 'Qt5' + x for x in dlls +) + +QT_PLUGINS = [ + 'imageformats', + 'iconengines', + # 'mediaservice', + 'platforms', + 'platformthemes', + # 'playlistformats', + 'sqldrivers', + # 'styles', + # 'webview', + # 'audio', 'printsupport', 'bearer', 'position', +] + +if not ismacos: + QT_PLUGINS.append('platforminputcontexts') + +if islinux: + QT_PLUGINS += [ + 'wayland-decoration-client', + 'wayland-graphics-integration-client', + 'wayland-shell-integration', + 'xcbglintegrations', + ] + +PYQT_MODULES = ( + 'Qt', + 'QtCore', + 'QtGui', + 'QtNetwork', + # 'QtMultimedia', 'QtMultimediaWidgets', + 'QtPrintSupport', + 'QtSensors', + 'QtSvg', + 'QtWebKit', + 'QtWebKitWidgets', + 'QtWidgets', + 'QtWebEngine', + 'QtWebEngineCore', + 'QtWebEngineWidgets', + # 'QtWebChannel', +) +del dlls + + def read_cal_file(name): with open(os.path.join(CALIBRE_DIR, 'src', 'calibre', name), 'rb') as f: return f.read().decode('utf-8') diff --git a/bypy/linux/__main__.py b/bypy/linux/__main__.py index 9756d51eee..9c10672b0a 100644 --- a/bypy/linux/__main__.py +++ b/bypy/linux/__main__.py @@ -17,7 +17,6 @@ from functools import partial from bypy.constants import ( OUTPUT_DIR, PREFIX, SRC as CALIBRE_DIR, is64bit, python_major_minor_version ) -from bypy.pkgs.qt_base import PYQT_MODULES, QT_DLLS, QT_PLUGINS from bypy.utils import ( create_job, get_dll_path, mkdtemp, parallel_build, py_compile, run, walk ) @@ -28,7 +27,9 @@ arch = 'x86_64' if is64bit else 'i686' py_ver = '.'.join(map(str, python_major_minor_version())) QT_PREFIX = os.path.join(PREFIX, 'qt') -calibre_constants = globals()['init_env']['calibre_constants'] +iv = globals()['init_env'] +calibre_constants = iv['calibre_constants'] +QT_DLLS, QT_PLUGINS, PYQT_MODULES = iv['QT_DLLS'], iv['QT_PLUGINS'], iv['PYQT_MODULES'] qt_get_dll_path = partial(get_dll_path, loc=os.path.join(QT_PREFIX, 'lib')) @@ -283,7 +284,7 @@ def create_tarfile(env, compression_level='9'): def main(): args = globals()['args'] ext_dir = globals()['ext_dir'] - run_tests = globals()['init_env']['run_tests'] + run_tests = iv['run_tests'] env = Env() copy_libs(env) copy_python(env, ext_dir) diff --git a/bypy/macos/__main__.py b/bypy/macos/__main__.py index a505f8411b..d8e9f1458f 100644 --- a/bypy/macos/__main__.py +++ b/bypy/macos/__main__.py @@ -24,11 +24,12 @@ from itertools import repeat from bypy.constants import ( OUTPUT_DIR, PREFIX, PYTHON, SRC as CALIBRE_DIR, python_major_minor_version ) -from bypy.pkgs.qt_base import PYQT_MODULES, QT_DLLS, QT_PLUGINS from bypy.utils import current_dir, mkdtemp, py_compile, timeit, walk abspath, join, basename, dirname = os.path.abspath, os.path.join, os.path.basename, os.path.dirname -calibre_constants = globals()['init_env']['calibre_constants'] +iv = globals()['init_env'] +calibre_constants = iv['calibre_constants'] +QT_DLLS, QT_PLUGINS, PYQT_MODULES = iv['QT_DLLS'], iv['QT_PLUGINS'], iv['PYQT_MODULES'] py_ver = '.'.join(map(str, python_major_minor_version())) sign_app = runpy.run_path(join(dirname(abspath(__file__)), 'sign.py'))['sign_app'] @@ -724,5 +725,5 @@ def main(args, ext_dir, test_runner): if __name__ == '__main__': args = globals()['args'] ext_dir = globals()['ext_dir'] - run_tests = globals()['init_env']['run_tests'] + run_tests = iv['run_tests'] main(args, ext_dir, run_tests)