summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-10-08 11:19:20 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-10-08 11:42:15 +0000
commit361a24ae1c3676f971a66d9e91715c07bc7bf5ed (patch)
treeb21453a2a3768133a94097640081d93ee55002e5
parenta48a3e95cfeb29b7823a7de1730bb255a6f462da (diff)
run_pro2cmake: Fix the file preference sorter
When invoking the script with "." as the only argument, and there are multiple .pro files in the current directory, the script would not choose the correct preferred .pro file (the one that has the same name as the current directory). Fix the sorter to handle such a case. Change-Id: I6df70d7c577649f8854bca9b8879f13bdb1b4d26 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rwxr-xr-xutil/cmake/run_pro2cmake.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/cmake/run_pro2cmake.py b/util/cmake/run_pro2cmake.py
index cb7181449a..0db9f2a607 100755
--- a/util/cmake/run_pro2cmake.py
+++ b/util/cmake/run_pro2cmake.py
@@ -77,7 +77,9 @@ def find_all_pro_files(base_path: str, args: argparse.Namespace):
""" Sorter that tries to prioritize main pro files in a directory. """
pro_file_without_suffix = pro_file.rsplit("/", 1)[-1][:-4]
dir_name = os.path.dirname(pro_file)
- if dir_name.endswith("/" + pro_file_without_suffix):
+ if dir_name == ".":
+ dir_name = os.path.basename(os.getcwd())
+ if dir_name.endswith(pro_file_without_suffix):
return dir_name
return dir_name + "/__" + pro_file