CMake: run_pro2cmake.py: Add statistics

Change-Id: I78e65970694d0c37c4b3c3ba6e6a83155579ea0f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tobias Hunger 2019-02-26 13:53:04 +01:00
parent eb832cb00a
commit 04d6981702

View File

@ -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))