From 34242345790242e8350fc6d49d71f34a7b93e446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Wed, 24 Jan 2024 14:45:36 +0100 Subject: [PATCH] wasm: make preload_qml_imports take a source path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was running qmlimportscanner on ".", which in some cases would recurse down the qt/ symlink in the app build directory (used with dynamic linking on wasm), and find all of the imports from the Qt installation. Make it take a path instead. Users can then provide a path to the QML sources which will be passed to qmlimportscanner Change-Id: Ib5175e5dc1d26875c42f5a3e286314b7d602c9fe Reviewed-by: Piotr WierciƄski Reviewed-by: Lorn Potter Reviewed-by: Qt CI Bot --- util/wasm/preload/preload_qml_imports.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/util/wasm/preload/preload_qml_imports.py b/util/wasm/preload/preload_qml_imports.py index a572f1f0ec..2f2fc7958f 100755 --- a/util/wasm/preload/preload_qml_imports.py +++ b/util/wasm/preload/preload_qml_imports.py @@ -80,21 +80,20 @@ def extract_preload_files_from_imports(imports): if __name__ == "__main__": - if len(sys.argv) != 3: - print("Usage: python make_qt_symlinks.py ") + if len(sys.argv) != 4: + print("Usage: python preload_qml_imports.py ") sys.exit(1) - qt_host_path = sys.argv[1] - qt_wasm_path = sys.argv[2] + qml_source_path = sys.argv[1] + qt_host_path = sys.argv[2] + qt_wasm_path = sys.argv[3] qml_import_path = os.path.join(qt_wasm_path, "qml") qmlimportsscanner_path = os.path.join(qt_host_path, "libexec/qmlimportscanner") eprint("runing qmlimportsscanner") - result = subprocess.run( - [qmlimportsscanner_path, "-rootPath", ".", "-importPath", qml_import_path], - stdout=subprocess.PIPE, - ) + command = [qmlimportsscanner_path, "-rootPath", qml_source_path, "-importPath", qml_import_path] + result = subprocess.run(command, stdout=subprocess.PIPE) imports = json.loads(result.stdout) preload_files = []