diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2019-08-21 16:19:16 +0200 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2019-08-23 07:06:48 +0000 |
commit | 3a105b9d11ea80c76b381410d9a92fc4c57dc244 (patch) | |
tree | 5de5535a989709ddd7465022963fb3a9a2ca1b41 /util | |
parent | 46603d655dbafbec20a599fb11fb9c81e34a26fe (diff) |
Extend run_pro2cmake.py to pass --is-example to pro2cmake
Add command line argument to make run_pro2cmake invoke pro2cmake with
the --is-example option so we can convert examples in bulk.
Change-Id: I162eddffc509f16a97de5517698e8daca5207b74
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-x | util/cmake/run_pro2cmake.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/util/cmake/run_pro2cmake.py b/util/cmake/run_pro2cmake.py index bc64fb3fbb..f98dbf63a8 100755 --- a/util/cmake/run_pro2cmake.py +++ b/util/cmake/run_pro2cmake.py @@ -42,6 +42,8 @@ def parse_command_line(): help='Run pro2cmake only on .pro files that already have a CMakeLists.txt.') parser.add_argument('--only-qtbase-main-modules', dest='only_qtbase_main_modules', action='store_true', help='Run pro2cmake only on the main modules in qtbase.') + parser.add_argument('--is-example', dest='is_example', action='store_true', + help='Run pro2cmake with --is-example flag.') parser.add_argument('path', metavar='<path>', type=str, help='The path where to look for .pro files.') @@ -126,7 +128,11 @@ def run(all_files: typing.List[str], pro2cmake: str, args: argparse.Namespace) - def _process_a_file(data: typing.Tuple[str, int, int]) -> typing.Tuple[int, str, str]: filename, index, total = data - result = subprocess.run((pro2cmake, os.path.basename(filename)), + pro2cmake_args = [pro2cmake] + if args.is_example: + pro2cmake_args.append('--is-example') + pro2cmake_args.append(os.path.basename(filename)) + result = subprocess.run(pro2cmake_args, cwd=os.path.dirname(filename), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout = 'Converted[{}/{}]: {}\n'.format(index, total, filename) |