diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2022-12-19 14:00:30 +0300 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2022-12-19 14:21:57 +0300 |
commit | 0530b324c14c0bbba9bc871ce060fceab08141c7 (patch) | |
tree | 6f40840cb3f3ae9600b81938a7e92b79d1d25eda /cargo_wrapper.py | |
parent | cb45ef2c0362c7570ef7a4c0e977493e7ea0a063 (diff) |
cargo_wrapper: Handle windows paths for depfiles
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1021>
Diffstat (limited to 'cargo_wrapper.py')
-rw-r--r-- | cargo_wrapper.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cargo_wrapper.py b/cargo_wrapper.py index 4bddf9d2e..6a6f3e4d3 100644 --- a/cargo_wrapper.py +++ b/cargo_wrapper.py @@ -32,7 +32,19 @@ def generate_depfile_for(fpath): with open(f"{file_stem}.d", 'r') as depfile: for l in depfile.readlines(): if l.startswith(str(file_stem)): - output, srcs = l.split(":", maxsplit=2) + # We can't blindly split on `:` because on Windows that's part + # of the drive letter. Lucky for us, the format of the dep file + # is one of: + # + # /path/to/output: /path/to/src1 /path/to/src2 + # /path/to/output: + # + # So we parse these two cases specifically + if l.endswith(':'): + output = l[:-1] + srcs = '' + else: + output, srcs = l.split(": ", maxsplit=2) all_deps = [] for src in srcs.split(" "): |