pro2cmake: Clean up debug messages
Don't needlessly show a bunch of special case debug messages unless debugging is enabled. There used to be a barrage of scary message when using run_pro2cmake. Change-Id: I49ab3522e11844a99653034b5f15a634a368d227 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
2199a50a2a
commit
37ab7eae9d
@ -3383,8 +3383,9 @@ def cmakeify_scope(
|
|||||||
cm_fh.write(buffer_value)
|
cm_fh.write(buffer_value)
|
||||||
|
|
||||||
|
|
||||||
def generate_new_cmakelists(scope: Scope, *, is_example: bool = False) -> None:
|
def generate_new_cmakelists(scope: Scope, *, is_example: bool = False, debug: bool = False) -> None:
|
||||||
print("Generating CMakeLists.gen.txt")
|
if debug:
|
||||||
|
print("Generating CMakeLists.gen.txt")
|
||||||
with open(scope.generated_cmake_lists_path, "w") as cm_fh:
|
with open(scope.generated_cmake_lists_path, "w") as cm_fh:
|
||||||
assert scope.file
|
assert scope.file
|
||||||
cm_fh.write(f"# Generated from {os.path.basename(scope.file)}.\n\n")
|
cm_fh.write(f"# Generated from {os.path.basename(scope.file)}.\n\n")
|
||||||
@ -3415,8 +3416,11 @@ def do_include(scope: Scope, *, debug: bool = False) -> None:
|
|||||||
scope.merge(include_scope)
|
scope.merge(include_scope)
|
||||||
|
|
||||||
|
|
||||||
def copy_generated_file_to_final_location(scope: Scope, keep_temporary_files=False) -> None:
|
def copy_generated_file_to_final_location(
|
||||||
print(f"Copying {scope.generated_cmake_lists_path} to {scope.original_cmake_lists_path}")
|
scope: Scope, keep_temporary_files=False, debug: bool = False
|
||||||
|
) -> None:
|
||||||
|
if debug:
|
||||||
|
print(f"Copying {scope.generated_cmake_lists_path} to {scope.original_cmake_lists_path}")
|
||||||
copyfile(scope.generated_cmake_lists_path, scope.original_cmake_lists_path)
|
copyfile(scope.generated_cmake_lists_path, scope.original_cmake_lists_path)
|
||||||
if not keep_temporary_files:
|
if not keep_temporary_files:
|
||||||
os.remove(scope.generated_cmake_lists_path)
|
os.remove(scope.generated_cmake_lists_path)
|
||||||
@ -3526,7 +3530,7 @@ def main() -> None:
|
|||||||
file_scope.dump()
|
file_scope.dump()
|
||||||
print("\n#### End of full .pro/.pri file structure.\n")
|
print("\n#### End of full .pro/.pri file structure.\n")
|
||||||
|
|
||||||
generate_new_cmakelists(file_scope, is_example=args.is_example)
|
generate_new_cmakelists(file_scope, is_example=args.is_example, debug=args.debug)
|
||||||
|
|
||||||
copy_generated_file = True
|
copy_generated_file = True
|
||||||
if not args.skip_special_case_preservation:
|
if not args.skip_special_case_preservation:
|
||||||
|
@ -161,13 +161,14 @@ def run_process_quiet(args_string: str, debug=False) -> bool:
|
|||||||
# git merge with conflicts returns with exit code 1, but that's not
|
# git merge with conflicts returns with exit code 1, but that's not
|
||||||
# an error for us.
|
# an error for us.
|
||||||
if "git merge" not in args_string:
|
if "git merge" not in args_string:
|
||||||
print(
|
if debug:
|
||||||
dedent(
|
print(
|
||||||
f"""\
|
dedent(
|
||||||
Error while running: "{args_string}"
|
f"""\
|
||||||
{e.stdout}"""
|
Error while running: "{args_string}"
|
||||||
|
{e.stdout}"""
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -333,9 +334,11 @@ class SpecialCaseHandler(object):
|
|||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
if failed_once and not success:
|
if failed_once and not success:
|
||||||
print("Retrying git add, the index.lock was probably acquired.")
|
if self.debug:
|
||||||
|
print("Retrying git add, the index.lock was probably acquired.")
|
||||||
if failed_once and success:
|
if failed_once and success:
|
||||||
print("git add succeeded.")
|
if self.debug:
|
||||||
|
print("git add succeeded.")
|
||||||
elif failed_once and not success:
|
elif failed_once and not success:
|
||||||
print(f"git add failed. Make sure to git add {self.prev_file_path} yourself.")
|
print(f"git add failed. Make sure to git add {self.prev_file_path} yourself.")
|
||||||
|
|
||||||
@ -375,11 +378,11 @@ class SpecialCaseHandler(object):
|
|||||||
copyfile_log(self.post_merge_file_path, self.generated_file_path)
|
copyfile_log(self.post_merge_file_path, self.generated_file_path)
|
||||||
if not self.keep_temporary_files:
|
if not self.keep_temporary_files:
|
||||||
os.remove(self.post_merge_file_path)
|
os.remove(self.post_merge_file_path)
|
||||||
|
if self.debug:
|
||||||
print(
|
print(
|
||||||
"Special case reapplication using git is complete. "
|
"Special case reapplication using git is complete. "
|
||||||
"Make sure to fix remaining conflict markers."
|
"Make sure to fix remaining conflict markers."
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error occurred while trying to reapply special case modifications: {e}")
|
print(f"Error occurred while trying to reapply special case modifications: {e}")
|
||||||
|
Loading…
Reference in New Issue
Block a user