From 04d69817027c37440a85b0f0ec8b9b0e8c037b56 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 26 Feb 2019 13:53:04 +0100 Subject: [PATCH] CMake: run_pro2cmake.py: Add statistics Change-Id: I78e65970694d0c37c4b3c3ba6e6a83155579ea0f Reviewed-by: Alexandru Croitor --- util/cmake/run_pro2cmake.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/util/cmake/run_pro2cmake.py b/util/cmake/run_pro2cmake.py index 4340eab0941..1a3c1581e39 100755 --- a/util/cmake/run_pro2cmake.py +++ b/util/cmake/run_pro2cmake.py @@ -34,11 +34,27 @@ import sys script_path = os.path.dirname(os.path.abspath(__file__)) base_path = os.path.dirname(script_path) -pro2cmake = script_path + '/pro2cmake.py' +pro2cmake = os.path.join(script_path, 'pro2cmake.py') if len(sys.argv) > 1: base_path = os.path.abspath(sys.argv[1]) -for filename in glob.iglob(base_path + '/**/*.pro', recursive=True): - print('Converting:', filename) - subprocess.run([pro2cmake, filename]) +failed_files = [] + +pro_file_count = 0 +for filename in glob.iglob(os.path.join(base_path, '**/*.pro'), + recursive=True): + pro_file_count += 1 + print('{} ({}): Converting: {} ...' + .format(pro_file_count, len(failed_files), filename)) + result = subprocess.run([pro2cmake, os.path.basename(filename)], + cwd=os.path.dirname(filename)) + if result.returncode != 0: + failed_files.append(filename) + +if failed_files: + print('The following files were not successfully ' + 'converted ({} of {}):'.format(len(failed_files), pro_file_count)) + for f in failed_files: + print(' "{}"'.format(f)) +