Skip to content

Commit d99eb19

Browse files
authored
Fix: target extraction from deps
replace split with rsplit to retrieve the correct Makefile target, when absolute windows paths are used
1 parent dd5a79e commit d99eb19

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

refresh.template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def _parse_headers_from_makefile_deps(d_file_content: str, source_path_for_sanit
161161
# We assume that this Makefile-like dependency file (`*.d`) contains exactly one `target: dependencies` rule.
162162
# There can be an optional space after the target, and long lists of dependencies (often) carry over with a backslash and newline.
163163
# For example, `d_file_content` might be: `"foo.o : foo.cc bar.h \\\n baz.hpp"`.
164-
target, dependencies = d_file_content.split(':', 1)
164+
target, dependencies = d_file_content.rsplit(':', 1)
165165
target = target.strip() # Remove the optional trailing space.
166166
assert target.endswith(('.o', '.obj')), "Something went wrong in makefile parsing to get headers. The target should be an object file. Output:\n" + d_file_content
167167
# Undo shell-like line wrapping because the newlines aren't eaten by shlex.join. Note also that it's the line wrapping is inconsistently generated across compilers and depends on the lengths of the filenames, so you can't just split on the escaped newlines.

0 commit comments

Comments
 (0)