blob: fc9bea78ff33526cfcf17ce9ab7070a80a4bc5ba [file] [log] [blame]
#!/usr/bin/env fuchsia-vendored-python
# Copyright 2021 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os
import subprocess
import sys
def main():
parser = argparse.ArgumentParser(
description="Executes a command, then rewrites the depfile, converts all absolute paths to relative"
"--depfile", help="Path to the depfile to rewrite", required=True
"command", nargs="+", help="Positional args for the command to run"
args = parser.parse_args()
retval =
if retval != 0:
return retval
lines = []
with open(args.depfile, "r") as f:
for line in f:
lines.append(" ".join(os.path.relpath(p) for p in line.split()))
with open(args.depfile, "w") as f:
if __name__ == "__main__":