blob: ffba2f5ebe3f60106072d58c83fc49856b6b49cf [file] [log] [blame]
#!/usr/bin/env python3.8
# 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(
'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__':