diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-11-11 18:47:28 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-11-12 10:12:35 +0000 |
commit | 37ab7eae9de557ad58cf371a6ce049fdf7545e6e (patch) | |
tree | a5f5f9f3303689e8504a2ac8cd26ec45788b2fa3 /util | |
parent | 2199a50a2a8dd7cd75cc6714c981452ffa5a3ed0 (diff) |
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>
Diffstat (limited to 'util')
-rwxr-xr-x | util/cmake/pro2cmake.py | 14 | ||||
-rw-r--r-- | util/cmake/special_case_helper.py | 29 |
2 files changed, 25 insertions, 18 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index ea5f2b91e1..d8168aa489 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -3383,8 +3383,9 @@ def cmakeify_scope( cm_fh.write(buffer_value) -def generate_new_cmakelists(scope: Scope, *, is_example: bool = False) -> None: - print("Generating CMakeLists.gen.txt") +def generate_new_cmakelists(scope: Scope, *, is_example: bool = False, debug: bool = False) -> None: + if debug: + print("Generating CMakeLists.gen.txt") with open(scope.generated_cmake_lists_path, "w") as cm_fh: assert scope.file 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) -def copy_generated_file_to_final_location(scope: Scope, keep_temporary_files=False) -> None: - print(f"Copying {scope.generated_cmake_lists_path} to {scope.original_cmake_lists_path}") +def copy_generated_file_to_final_location( + 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) if not keep_temporary_files: os.remove(scope.generated_cmake_lists_path) @@ -3526,7 +3530,7 @@ def main() -> None: file_scope.dump() 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 if not args.skip_special_case_preservation: diff --git a/util/cmake/special_case_helper.py b/util/cmake/special_case_helper.py index 60443aeb61..48c7181a04 100644 --- a/util/cmake/special_case_helper.py +++ b/util/cmake/special_case_helper.py @@ -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 # an error for us. if "git merge" not in args_string: - print( - dedent( - f"""\ - Error while running: "{args_string}" - {e.stdout}""" + if debug: + print( + dedent( + f"""\ + Error while running: "{args_string}" + {e.stdout}""" + ) ) - ) return False return True @@ -333,9 +334,11 @@ class SpecialCaseHandler(object): time.sleep(0.1) 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: - print("git add succeeded.") + if self.debug: + print("git add succeeded.") elif failed_once and not success: 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) if not self.keep_temporary_files: os.remove(self.post_merge_file_path) - - print( - "Special case reapplication using git is complete. " - "Make sure to fix remaining conflict markers." - ) + if self.debug: + print( + "Special case reapplication using git is complete. " + "Make sure to fix remaining conflict markers." + ) except Exception as e: print(f"Error occurred while trying to reapply special case modifications: {e}") |