From 21a281d9622b22fa8bd6f731226eff8e5ee9802d Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 8 Sep 2021 15:53:29 +0200 Subject: pro2cmake: run make format to fix styling issues Pick-to: 6.2 Change-Id: I718e34d628576bb709096c0672da3a69b71ae8df Reviewed-by: Alexey Edelev --- util/cmake/condition_simplifier.py | 8 ++-- util/cmake/configurejson2cmake.py | 23 ++++++++---- util/cmake/helper.py | 75 +++++++++++++++++++++++++++++--------- util/cmake/pro2cmake.py | 10 +++-- 4 files changed, 82 insertions(+), 34 deletions(-) (limited to 'util') diff --git a/util/cmake/condition_simplifier.py b/util/cmake/condition_simplifier.py index e6588a7cc7..e8fc0e40d2 100644 --- a/util/cmake/condition_simplifier.py +++ b/util/cmake/condition_simplifier.py @@ -72,8 +72,8 @@ def _simplify_expressions(expr, op, matches, replacement): def _simplify_flavors_in_condition(base: str, flavors, expr): - """ Simplify conditions based on the knowledge of which flavors - belong to which OS. """ + """Simplify conditions based on the knowledge of which flavors + belong to which OS.""" base_expr = simplify_logic(base) false_expr = simplify_logic("false") for flavor in flavors: @@ -100,8 +100,8 @@ def _simplify_os_families(expr, family_members, other_family_members): def _recursive_simplify(expr): - """ Simplify the expression as much as possible based on - domain knowledge. """ + """Simplify the expression as much as possible based on + domain knowledge.""" input_expr = expr # Simplify even further, based on domain knowledge: diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index b5e148f63c..3be7118080 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -611,7 +611,7 @@ def write_compile_test( head = detail.get("head") if isinstance(head, list): head = "\n".join(head) - return head + '\n' if head else '' + return head + "\n" if head else "" head = "" if inherit_details: @@ -646,7 +646,7 @@ def write_compile_test( tail = detail.get("tail") if isinstance(tail, list): tail = "\n".join(tail) - return tail + '\n' if tail else '' + return tail + "\n" if tail else "" tail = "" if inherit_details: @@ -655,8 +655,8 @@ def write_compile_test( sourceCode += tail - if sourceCode: # blank line before main - sourceCode += '\n' + if sourceCode: # blank line before main + sourceCode += "\n" sourceCode += "int main(void)\n" sourceCode += "{\n" sourceCode += " /* BEGIN TEST: */\n" @@ -665,7 +665,7 @@ def write_compile_test( main = detail.get("main") if isinstance(main, list): main = "\n".join(main) - return main + '\n' if main else '' + return main + "\n" if main else "" main = "" if inherit_details: @@ -943,7 +943,11 @@ endif()""", "qreal": { "condition": 'DEFINED QT_COORD_TYPE AND NOT QT_COORD_TYPE STREQUAL "double"', "output": [ - {"type": "define", "name": "QT_COORD_TYPE", "value": "${QT_COORD_TYPE}",}, + { + "type": "define", + "name": "QT_COORD_TYPE", + "value": "${QT_COORD_TYPE}", + }, { "type": "define", "name": "QT_COORD_TYPE_STRING", @@ -951,7 +955,9 @@ endif()""", }, ], }, - "reduce_exports": {"condition": "NOT MSVC",}, + "reduce_exports": { + "condition": "NOT MSVC", + }, "release": None, "release_tools": None, "rpath": { @@ -1524,6 +1530,7 @@ class special_cased_file: self.sc_handler.handle_special_cases() os.replace(self.gen_file_path, self.file_path) + def processJson(path, ctx, data, skip_special_case_preservation=False): ctx["project_dir"] = path ctx["module"] = data.get("module", "global") @@ -1571,7 +1578,7 @@ def main(): quit(1) directory = sys.argv[1] - skip_special_case_preservation = '-s' in sys.argv[2:] + skip_special_case_preservation = "-s" in sys.argv[2:] print(f"Processing: {directory}.") diff --git a/util/cmake/helper.py b/util/cmake/helper.py index dcb2b611b5..34479b4626 100644 --- a/util/cmake/helper.py +++ b/util/cmake/helper.py @@ -148,7 +148,10 @@ _qt_library_map = [ extra=["COMPONENTS", "EglFSDeviceIntegrationPrivate"], ), LibraryMapping( - "eglfs_kms_support", "Qt6", "Qt::EglFsKmsSupportPrivate", extra=["COMPONENTS", "EglFsKmsSupportPrivate"] + "eglfs_kms_support", + "Qt6", + "Qt::EglFsKmsSupportPrivate", + extra=["COMPONENTS", "EglFsKmsSupportPrivate"], ), LibraryMapping( "eglfs_kms_gbm_support", @@ -170,8 +173,12 @@ _qt_library_map = [ "Qt::EventDispatcherSupport", extra=["COMPONENTS", "EventDispatcherSupport"], ), - LibraryMapping("fbconvenience", "Qt6", "Qt::FbSupportPrivate", extra=["COMPONENTS", "FbSupportPrivate"]), - LibraryMapping("fb_support", "Qt6", "Qt::FbSupportPrivate", extra=["COMPONENTS", "FbSupportPrivate"]), + LibraryMapping( + "fbconvenience", "Qt6", "Qt::FbSupportPrivate", extra=["COMPONENTS", "FbSupportPrivate"] + ), + LibraryMapping( + "fb_support", "Qt6", "Qt::FbSupportPrivate", extra=["COMPONENTS", "FbSupportPrivate"] + ), LibraryMapping( "fontdatabase_support", "Qt6", @@ -195,9 +202,14 @@ _qt_library_map = [ "Qt::HunspellInputMethodPrivate", extra=["COMPONENTS", "HunspellInputMethodPrivate"], ), - LibraryMapping("input", "Qt6", "Qt::InputSupportPrivate", extra=["COMPONENTS", "InputSupportPrivate"]), LibraryMapping( - "input_support", "Qt6", "Qt::InputSupportPrivate", extra=["COMPONENTS", "InputSupportPrivate"] + "input", "Qt6", "Qt::InputSupportPrivate", extra=["COMPONENTS", "InputSupportPrivate"] + ), + LibraryMapping( + "input_support", + "Qt6", + "Qt::InputSupportPrivate", + extra=["COMPONENTS", "InputSupportPrivate"], ), LibraryMapping( "installer-lib", "Qt6", "Qt::AppManInstaller", extra=["COMPONENTS", "AppManInstaller"] @@ -206,8 +218,12 @@ _qt_library_map = [ LibraryMapping("ivicore", "Qt6", "Qt::IviCore", extra=["COMPONENTS", "IviCore"]), LibraryMapping("ivimedia", "Qt6", "Qt::IviMedia", extra=["COMPONENTS", "IviMedia"]), LibraryMapping("knx", "Qt6", "Qt::Knx", extra=["COMPONENTS", "Knx"]), - LibraryMapping("kmsconvenience", "Qt6", "Qt::KmsSupportPrivate", extra=["COMPONENTS", "KmsSupportPrivate"]), - LibraryMapping("kms_support", "Qt6", "Qt::KmsSupportPrivate", extra=["COMPONENTS", "KmsSupportPrivate"]), + LibraryMapping( + "kmsconvenience", "Qt6", "Qt::KmsSupportPrivate", extra=["COMPONENTS", "KmsSupportPrivate"] + ), + LibraryMapping( + "kms_support", "Qt6", "Qt::KmsSupportPrivate", extra=["COMPONENTS", "KmsSupportPrivate"] + ), LibraryMapping( "launcher-lib", "Qt6", "Qt::AppManLauncher", extra=["COMPONENTS", "AppManLauncher"] ), @@ -251,10 +267,16 @@ _qt_library_map = [ "package-lib", "Qt6", "Qt::AppManPackage", extra=["COMPONENTS", "AppManPackage"] ), LibraryMapping( - "packetprotocol", "Qt6", "Qt::PacketProtocolPrivate", extra=["COMPONENTS", "PacketProtocolPrivate"] + "packetprotocol", + "Qt6", + "Qt::PacketProtocolPrivate", + extra=["COMPONENTS", "PacketProtocolPrivate"], ), LibraryMapping( - "particles", "Qt6", "Qt::QuickParticlesPrivate", extra=["COMPONENTS", "QuickParticlesPrivate"] + "particles", + "Qt6", + "Qt::QuickParticlesPrivate", + extra=["COMPONENTS", "QuickParticlesPrivate"], ), LibraryMapping( "plugin-interfaces", @@ -268,9 +290,15 @@ _qt_library_map = [ ), LibraryMapping("printsupport", "Qt6", "Qt::PrintSupport", extra=["COMPONENTS", "PrintSupport"]), LibraryMapping("purchasing", "Qt6", "Qt::Purchasing", extra=["COMPONENTS", "Purchasing"]), - LibraryMapping("qmldebug", "Qt6", "Qt::QmlDebugPrivate", extra=["COMPONENTS", "QmlDebugPrivate"]), - LibraryMapping("qmldevtools", "Qt6", "Qt::QmlDevToolsPrivate", extra=["COMPONENTS", "QmlDevToolsPrivate"]), - LibraryMapping("qmlcompiler", "Qt6", "Qt::QmlCompilerPrivate", extra=["COMPONENTS", "QmlCompilerPrivate"]), + LibraryMapping( + "qmldebug", "Qt6", "Qt::QmlDebugPrivate", extra=["COMPONENTS", "QmlDebugPrivate"] + ), + LibraryMapping( + "qmldevtools", "Qt6", "Qt::QmlDevToolsPrivate", extra=["COMPONENTS", "QmlDevToolsPrivate"] + ), + LibraryMapping( + "qmlcompiler", "Qt6", "Qt::QmlCompilerPrivate", extra=["COMPONENTS", "QmlCompilerPrivate"] + ), LibraryMapping("qml", "Qt6", "Qt::Qml", extra=["COMPONENTS", "Qml"]), LibraryMapping("qmldom", "Qt6", "Qt::QmlDomPrivate", extra=["COMPONENTS", "QmlDomPrivate"]), LibraryMapping("qmlmodels", "Qt6", "Qt::QmlModels", extra=["COMPONENTS", "QmlModels"]), @@ -309,7 +337,9 @@ _qt_library_map = [ extra=["COMPONENTS", "QuickControls2Impl"], ), LibraryMapping("quick", "Qt6", "Qt::Quick", extra=["COMPONENTS", "Quick"]), - LibraryMapping("quickshapes", "Qt6", "Qt::QuickShapesPrivate", extra=["COMPONENTS", "QuickShapesPrivate"]), + LibraryMapping( + "quickshapes", "Qt6", "Qt::QuickShapesPrivate", extra=["COMPONENTS", "QuickShapesPrivate"] + ), LibraryMapping( "quicktemplates2", "Qt6", "Qt::QuickTemplates2", extra=["COMPONENTS", "QuickTemplates2"] ), @@ -364,7 +394,9 @@ _qt_library_map = [ LibraryMapping("window-lib", "Qt6", "Qt::AppManWindow", extra=["COMPONENTS", "AppManWindow"]), LibraryMapping("winextras", "Qt6", "Qt::WinExtras", extra=["COMPONENTS", "WinExtras"]), LibraryMapping("x11extras", "Qt6", "Qt::X11Extras", extra=["COMPONENTS", "X11Extras"]), - LibraryMapping("xcb_qpa_lib", "Qt6", "Qt::XcbQpaPrivate", extra=["COMPONENTS", "XcbQpaPrivate"]), + LibraryMapping( + "xcb_qpa_lib", "Qt6", "Qt::XcbQpaPrivate", extra=["COMPONENTS", "XcbQpaPrivate"] + ), LibraryMapping( "xkbcommon_support", "Qt6", "Qt::XkbCommonSupport", extra=["COMPONENTS", "XkbCommonSupport"] ), @@ -374,7 +406,10 @@ _qt_library_map = [ "qmlworkerscript", "Qt6", "Qt::QmlWorkerScript", extra=["COMPONENTS", "QmlWorkerScript"] ), LibraryMapping( - "quickparticles", "Qt6", "Qt::QuickParticlesPrivate", extra=["COMPONENTS", "QuickParticlesPrivate"] + "quickparticles", + "Qt6", + "Qt::QuickParticlesPrivate", + extra=["COMPONENTS", "QuickParticlesPrivate"], ), LibraryMapping( "linuxofono_support", @@ -402,7 +437,9 @@ _qt_library_map = [ _library_map = [ # 3rd party: LibraryMapping("atspi", "ATSPI2", "PkgConfig::ATSPI2"), - LibraryMapping("backtrace", "WrapBacktrace", "WrapBacktrace::WrapBacktrace", emit_if="config.unix"), + LibraryMapping( + "backtrace", "WrapBacktrace", "WrapBacktrace::WrapBacktrace", emit_if="config.unix" + ), LibraryMapping("bluez", "BlueZ", "PkgConfig::BlueZ"), LibraryMapping("brotli", "WrapBrotli", "WrapBrotli::WrapBrotliDec"), LibraryMapping("corewlan", None, None), @@ -496,7 +533,9 @@ _library_map = [ LibraryMapping("sqlite2", None, None), # No more sqlite2 support in Qt6! LibraryMapping("sqlite3", "SQLite3", "SQLite::SQLite3"), LibraryMapping("sqlite", "SQLite3", "SQLite::SQLite3"), - LibraryMapping("taglib", "WrapTagLib", "WrapTagLib::WrapTagLib", is_bundled_with_qt=True), # used in qtivi + LibraryMapping( + "taglib", "WrapTagLib", "WrapTagLib::WrapTagLib", is_bundled_with_qt=True + ), # used in qtivi LibraryMapping("tslib", "Tslib", "PkgConfig::Tslib"), LibraryMapping("udev", "Libudev", "PkgConfig::Libudev"), LibraryMapping("udev", "Libudev", "PkgConfig::Libudev"), # see also libudev! @@ -681,7 +720,7 @@ def find_library_info_for_target(targetName: str) -> typing.Optional[LibraryMapp # For a given qmake library (e.g. 'openssl_headers'), check whether this is a fake library used # for the /nolink annotation, and return the actual annotated qmake library ('openssl/nolink'). -def find_annotated_qmake_lib_name(lib : str) -> str: +def find_annotated_qmake_lib_name(lib: str) -> str: for entry in _library_map: if entry.no_link_so_name == lib: return entry.soName + "/nolink" diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 2879243ef8..7a522b494b 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -3194,7 +3194,9 @@ def write_main_part( cm_fh.write(f"{spaces(indent)}if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)\n") cm_fh.write(f"{spaces(indent+1)}cmake_minimum_required(VERSION 3.16)\n") cm_fh.write(f"{spaces(indent+1)}project({name} LANGUAGES C CXX ASM)\n") - cm_fh.write(f"{spaces(indent+1)}find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST)\n") + cm_fh.write( + f"{spaces(indent+1)}find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST)\n" + ) cm_fh.write(f"{spaces(indent)}endif()\n\n") test_data = scope.expand("TESTDATA") @@ -3445,7 +3447,7 @@ def write_module(cm_fh: IO[str], scope: Scope, *, indent: int = 0) -> str: extra.append("STATIC") if "internal_module" in scope.get("CONFIG"): is_public_module = False - cmake_target_name += "Private" # Assume all internal modules have the 'Private' suffix + cmake_target_name += "Private" # Assume all internal modules have the 'Private' suffix extra.append("INTERNAL_MODULE") if "no_module_headers" in scope.get("CONFIG"): extra.append("NO_MODULE_HEADERS") @@ -3865,9 +3867,9 @@ def write_example( property_win32, property_mac_bundle = get_win32_and_mac_bundle_properties(scope) if property_win32: - add_target += ' ' + "WIN32" + add_target += " " + "WIN32" if property_mac_bundle: - add_target += ' ' + "MACOSX_BUNDLE" + add_target += " " + "MACOSX_BUNDLE" write_all_source_file_lists(cm_fh, scope, add_target, indent=0) cm_fh.write(")\n") -- cgit v1.2.3