aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/cmake/traceparser.py
diff options
context:
space:
mode:
authorgeorgev93 <georgeavogt93@gmail.com>2020-04-25 16:42:52 -0400
committerDaniel Mensinger <daniel@mensinger-ka.de>2020-04-28 19:54:34 +0200
commit30b89ea57307f09563db862b307e873cc1e7cfc3 (patch)
tree274ebb3f5db8cc739eac3e691330143726cd6eb3 /mesonbuild/cmake/traceparser.py
parent76c36a64c3e55692f5d37b1f1762fac448e845bd (diff)
downloadmeson-30b89ea57307f09563db862b307e873cc1e7cfc3.zip
meson-30b89ea57307f09563db862b307e873cc1e7cfc3.tar.gz
meson-30b89ea57307f09563db862b307e873cc1e7cfc3.tar.bz2
Adding a conditional case in _guess_files to confirm that the complete path is put together in even if a portion of the path is a location that exists.
For instance if C:/Program Files (x86)/folder is passed to _guess_files, it would resolve to ['C:/Program Files', '(x86)/folder'] since C:/Program Files is an actual file location that can exist.
Diffstat (limited to 'mesonbuild/cmake/traceparser.py')
-rw-r--r--mesonbuild/cmake/traceparser.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/mesonbuild/cmake/traceparser.py b/mesonbuild/cmake/traceparser.py
index 0aee3fa..f20bcc8 100644
--- a/mesonbuild/cmake/traceparser.py
+++ b/mesonbuild/cmake/traceparser.py
@@ -660,25 +660,40 @@ class CMakeTraceParser:
fixed_list = [] # type: T.List[str]
curr_str = None # type: T.Optional[str]
+ path_found = False # type: bool
for i in broken_list:
if curr_str is None:
curr_str = i
+ path_found = False
elif os.path.isfile(curr_str):
# Abort concatenation if curr_str is an existing file
fixed_list += [curr_str]
curr_str = i
+ path_found = False
elif not reg_start.match(curr_str):
# Abort concatenation if curr_str no longer matches the regex
fixed_list += [curr_str]
curr_str = i
- elif reg_end.match(i) or os.path.exists('{} {}'.format(curr_str, i)):
+ path_found = False
+ elif reg_end.match(i):
# File detected
curr_str = '{} {}'.format(curr_str, i)
fixed_list += [curr_str]
curr_str = None
+ path_found = False
+ elif os.path.exists('{} {}'.format(curr_str, i)):
+ # Path detected
+ curr_str = '{} {}'.format(curr_str, i)
+ path_found = True
+ elif path_found:
+ # Add path to fixed_list after ensuring the whole path is in curr_str
+ fixed_list += [curr_str]
+ curr_str = i
+ path_found = False
else:
curr_str = '{} {}'.format(curr_str, i)
+ path_found = False
if curr_str:
fixed_list += [curr_str]