From fd52a6fcb952ec5790e776fe1b97b47d6c5b6f89 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 23 Jun 2020 18:21:24 +0200 Subject: [PATCH] pro2cmake.py: Parse qmldir import statements with versions You can write the following in a qmldir file these days: import QtQuick auto import QtQml 2.4 pro2cmake should understand and convert these to cmake. Change-Id: Ica1728de0c8d7a0b2b5aa341d20e60b23dfa7fe1 Reviewed-by: Fabian Kosmale --- util/cmake/pro2cmake.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 441f8335e20..5f52c3218fb 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -681,7 +681,10 @@ class QmlDir: elif entries[0] == "designersupported": self.designer_supported = True elif entries[0] == "import": - self.imports.append(entries[1]) + if len(entries) == 3: + self.imports.append(entries[1] + "/" + entries[2]) + else: + self.imports.append(entries[1]) elif len(entries) == 3: self.handle_file(entries[0], entries[1], entries[2]) else: @@ -3399,7 +3402,7 @@ def write_example( raise RuntimeError( "Only qmldir import statements expected in conditional scope!" ) - import_list.append(qml_import[len("import ") :]) + import_list.append(qml_import[len("import ") :].replace(" ", "/")) if len(import_list) == 0: continue @@ -3703,7 +3706,7 @@ def write_qml_plugin( raise RuntimeError( "Only qmldir import statements expected in conditional scope!" ) - import_list.append(qml_import[len("import ") :]) + import_list.append(qml_import[len("import ") :].replace(" ", "/")) if len(import_list) == 0: continue