pro2cmake: Re-format sources with black
...to have a consistent baseline for further improvements. Change-Id: Iba8e83a7a5cf5ca0cdf509f79e7d2dc2d8f42fec Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
354e4e867a
commit
8a6899239a
@ -935,5 +935,9 @@ def _set_up_py_parsing_nicer_debug_output(pp):
|
|||||||
pp._defaultExceptionDebugAction = decrease_indent(pp._defaultExceptionDebugAction)
|
pp._defaultExceptionDebugAction = decrease_indent(pp._defaultExceptionDebugAction)
|
||||||
elif hasattr(pp.core, "_default_start_debug_action"):
|
elif hasattr(pp.core, "_default_start_debug_action"):
|
||||||
pp.core._default_start_debug_action = increase_indent(pp.core._default_start_debug_action)
|
pp.core._default_start_debug_action = increase_indent(pp.core._default_start_debug_action)
|
||||||
pp.core._default_success_debug_action = decrease_indent(pp.core._default_success_debug_action)
|
pp.core._default_success_debug_action = decrease_indent(
|
||||||
pp.core._default_exception_debug_action = decrease_indent(pp.core._default_exception_debug_action)
|
pp.core._default_success_debug_action
|
||||||
|
)
|
||||||
|
pp.core._default_exception_debug_action = decrease_indent(
|
||||||
|
pp.core._default_exception_debug_action
|
||||||
|
)
|
||||||
|
@ -358,14 +358,14 @@ def find_qmake_or_cmake_conf(project_file_path: str = "") -> str:
|
|||||||
def parse_qt_repo_module_version_from_qmake_conf(qmake_conf_path: str = "") -> str:
|
def parse_qt_repo_module_version_from_qmake_conf(qmake_conf_path: str = "") -> str:
|
||||||
with open(qmake_conf_path) as f:
|
with open(qmake_conf_path) as f:
|
||||||
file_contents = f.read()
|
file_contents = f.read()
|
||||||
m = re.search(fr"MODULE_VERSION\s*=\s*([0-9.]+)", file_contents)
|
m = re.search(r"MODULE_VERSION\s*=\s*([0-9.]+)", file_contents)
|
||||||
return m.group(1) if m else ""
|
return m.group(1) if m else ""
|
||||||
|
|
||||||
|
|
||||||
def parse_qt_repo_module_version_from_cmake_conf(cmake_conf_path: str = "") -> str:
|
def parse_qt_repo_module_version_from_cmake_conf(cmake_conf_path: str = "") -> str:
|
||||||
with open(cmake_conf_path) as f:
|
with open(cmake_conf_path) as f:
|
||||||
file_contents = f.read()
|
file_contents = f.read()
|
||||||
m = re.search(fr'set\(QT_REPO_MODULE_VERSION\s*"([0-9.]+)"\)', file_contents)
|
m = re.search(r'set\(QT_REPO_MODULE_VERSION\s*"([0-9.]+)"\)', file_contents)
|
||||||
return m.group(1) if m else ""
|
return m.group(1) if m else ""
|
||||||
|
|
||||||
|
|
||||||
@ -2502,7 +2502,7 @@ def write_resources(
|
|||||||
immediate_base_list = scope.get(f"{r}.base")
|
immediate_base_list = scope.get(f"{r}.base")
|
||||||
assert (
|
assert (
|
||||||
len(immediate_base_list) < 2
|
len(immediate_base_list) < 2
|
||||||
), f"immediate base directory must be at most one entry"
|
), "immediate base directory must be at most one entry"
|
||||||
immediate_base = replace_path_constants("".join(immediate_base_list), scope)
|
immediate_base = replace_path_constants("".join(immediate_base_list), scope)
|
||||||
immediate_lang = None
|
immediate_lang = None
|
||||||
immediate_name = f"qmake_{r}"
|
immediate_name = f"qmake_{r}"
|
||||||
@ -2579,7 +2579,7 @@ def write_qlalrsources(cm_fh: IO[str], target: str, scope: Scope, indent: int =
|
|||||||
if not sources:
|
if not sources:
|
||||||
return
|
return
|
||||||
cm_fh.write("\n# QLALR Grammars:\n")
|
cm_fh.write("\n# QLALR Grammars:\n")
|
||||||
cm_fh.write(f"qt_process_qlalr(\n")
|
cm_fh.write("qt_process_qlalr(\n")
|
||||||
indent += 1
|
indent += 1
|
||||||
cm_fh.write(f"{spaces(indent)}{target}\n")
|
cm_fh.write(f"{spaces(indent)}{target}\n")
|
||||||
cm_fh.write(f"{spaces(indent)}{';'.join(sources)}\n")
|
cm_fh.write(f"{spaces(indent)}{';'.join(sources)}\n")
|
||||||
@ -2650,7 +2650,7 @@ def write_target_sources(
|
|||||||
):
|
):
|
||||||
command_name = "target_sources"
|
command_name = "target_sources"
|
||||||
header = f"{command_name}({target} {visibility}\n"
|
header = f"{command_name}({target} {visibility}\n"
|
||||||
write_list(cm_fh, sources, "", indent, footer=f")", header=header)
|
write_list(cm_fh, sources, "", indent, footer=")", header=header)
|
||||||
|
|
||||||
|
|
||||||
def expand_project_requirements(scope: Scope, skip_message: bool = False) -> str:
|
def expand_project_requirements(scope: Scope, skip_message: bool = False) -> str:
|
||||||
@ -3728,7 +3728,7 @@ def write_jar(cm_fh: IO[str], scope: Scope, *, indent: int = 0) -> str:
|
|||||||
android_sdk_jar = "${android_sdk}"
|
android_sdk_jar = "${android_sdk}"
|
||||||
|
|
||||||
write_source_file_list(
|
write_source_file_list(
|
||||||
cm_fh, scope, "", ["JAVASOURCES"], indent=indent, header=f"set(java_sources\n", footer=")\n"
|
cm_fh, scope, "", ["JAVASOURCES"], indent=indent, header="set(java_sources\n", footer=")\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
cm_fh.write(f"{spaces(indent)}qt_internal_add_jar({target}\n")
|
cm_fh.write(f"{spaces(indent)}qt_internal_add_jar({target}\n")
|
||||||
@ -3873,9 +3873,9 @@ def write_example(
|
|||||||
assert sc.condition
|
assert sc.condition
|
||||||
|
|
||||||
add_target += f"if ({sc.condition})\n"
|
add_target += f"if ({sc.condition})\n"
|
||||||
add_target += f" list(APPEND module_dynamic_qml_imports\n "
|
add_target += " list(APPEND module_dynamic_qml_imports\n "
|
||||||
add_target += "\n ".join(import_list)
|
add_target += "\n ".join(import_list)
|
||||||
add_target += f"\n )\nendif()\n\n"
|
add_target += "\n )\nendif()\n\n"
|
||||||
|
|
||||||
add_target += dedent(
|
add_target += dedent(
|
||||||
f"""\
|
f"""\
|
||||||
@ -4200,9 +4200,9 @@ def write_qml_plugin(
|
|||||||
assert sc.condition
|
assert sc.condition
|
||||||
|
|
||||||
cm_fh.write(f"if ({sc.condition})\n")
|
cm_fh.write(f"if ({sc.condition})\n")
|
||||||
cm_fh.write(f" list(APPEND module_dynamic_qml_imports\n ")
|
cm_fh.write(" list(APPEND module_dynamic_qml_imports\n ")
|
||||||
cm_fh.write("\n ".join(import_list))
|
cm_fh.write("\n ".join(import_list))
|
||||||
cm_fh.write(f"\n )\nendif()\n\n")
|
cm_fh.write("\n )\nendif()\n\n")
|
||||||
|
|
||||||
if qml_dir is not None:
|
if qml_dir is not None:
|
||||||
if qml_dir.designer_supported:
|
if qml_dir.designer_supported:
|
||||||
@ -4413,7 +4413,7 @@ def handle_top_level_repo_project(scope: Scope, cm_fh: IO[str]):
|
|||||||
)
|
)
|
||||||
|
|
||||||
build_repo = dedent(
|
build_repo = dedent(
|
||||||
f"""\
|
"""\
|
||||||
qt_build_repo()
|
qt_build_repo()
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
@ -4445,7 +4445,7 @@ def find_top_level_repo_project_file(project_file_path: str = "") -> Optional[st
|
|||||||
def handle_top_level_repo_tests_project(scope: Scope, cm_fh: IO[str]):
|
def handle_top_level_repo_tests_project(scope: Scope, cm_fh: IO[str]):
|
||||||
|
|
||||||
content = dedent(
|
content = dedent(
|
||||||
f"""\
|
"""\
|
||||||
if(QT_BUILD_STANDALONE_TESTS)
|
if(QT_BUILD_STANDALONE_TESTS)
|
||||||
# Add qt_find_package calls for extra dependencies that need to be found when building
|
# Add qt_find_package calls for extra dependencies that need to be found when building
|
||||||
# the standalone tests here.
|
# the standalone tests here.
|
||||||
@ -4467,14 +4467,14 @@ def write_regular_cmake_target_scope_section(
|
|||||||
write_include_paths(
|
write_include_paths(
|
||||||
cm_fh,
|
cm_fh,
|
||||||
scope,
|
scope,
|
||||||
f"target_include_directories(${{PROJECT_NAME}} PUBLIC",
|
"target_include_directories(${{PROJECT_NAME}} PUBLIC",
|
||||||
indent=indent,
|
indent=indent,
|
||||||
footer=")",
|
footer=")",
|
||||||
)
|
)
|
||||||
write_defines(
|
write_defines(
|
||||||
cm_fh,
|
cm_fh,
|
||||||
scope,
|
scope,
|
||||||
f"target_compile_definitions(${{PROJECT_NAME}} PUBLIC",
|
"target_compile_definitions(${{PROJECT_NAME}} PUBLIC",
|
||||||
indent=indent,
|
indent=indent,
|
||||||
footer=")",
|
footer=")",
|
||||||
)
|
)
|
||||||
@ -4484,7 +4484,7 @@ def write_regular_cmake_target_scope_section(
|
|||||||
private_libs,
|
private_libs,
|
||||||
"",
|
"",
|
||||||
indent=indent,
|
indent=indent,
|
||||||
header=f"target_link_libraries(${{PROJECT_NAME}} PRIVATE\n",
|
header="target_link_libraries(${{PROJECT_NAME}} PRIVATE\n",
|
||||||
footer=")",
|
footer=")",
|
||||||
)
|
)
|
||||||
write_list(
|
write_list(
|
||||||
@ -4492,11 +4492,11 @@ def write_regular_cmake_target_scope_section(
|
|||||||
public_libs,
|
public_libs,
|
||||||
"",
|
"",
|
||||||
indent=indent,
|
indent=indent,
|
||||||
header=f"target_link_libraries(${{PROJECT_NAME}} PUBLIC\n",
|
header="target_link_libraries(${{PROJECT_NAME}} PUBLIC\n",
|
||||||
footer=")",
|
footer=")",
|
||||||
)
|
)
|
||||||
write_compile_options(
|
write_compile_options(
|
||||||
cm_fh, scope, f"target_compile_options(${{PROJECT_NAME}}", indent=indent, footer=")"
|
cm_fh, scope, "target_compile_options(${{PROJECT_NAME}}", indent=indent, footer=")"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -4534,7 +4534,7 @@ endif()
|
|||||||
# Remove default QT libs.
|
# Remove default QT libs.
|
||||||
scope._append_operation("QT", RemoveOperation(["core", "gui"]))
|
scope._append_operation("QT", RemoveOperation(["core", "gui"]))
|
||||||
|
|
||||||
add_target = f"add_executable(${{PROJECT_NAME}}"
|
add_target = "add_executable(${{PROJECT_NAME}}"
|
||||||
|
|
||||||
temp_buffer = io.StringIO()
|
temp_buffer = io.StringIO()
|
||||||
write_all_source_file_lists(temp_buffer, scope, add_target, indent=0)
|
write_all_source_file_lists(temp_buffer, scope, add_target, indent=0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user