Debian Codegraph @

third_party/dawn/fetch_and_stamp.py

raw
1 #!/usr/bin/env python3
2 #
3 # Copyright 2025 Google LLC
4 #
5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file.
7 #
8
9 import argparse
10 import os
11 import subprocess
12 import sys
13
14 def main():
15 parser = argparse.ArgumentParser()
16 parser.add_argument("--stamp_path", required=True, help="Path to the output stamp file.")
17 parser.add_argument("--depfile_path", required=True, help="Path to the output depfile.")
18 parser.add_argument("--dawn_dir", required=True, help="Path to the Dawn checkout.")
19 args = parser.parse_args()
20
21 fetch_script = os.path.join(args.dawn_dir, "tools", "fetch_dawn_dependencies.py")
22 subprocess.check_call([sys.executable, fetch_script, "--directory=" + args.dawn_dir])
23
24 # Create the stamp file.
25 with open(args.stamp_path, "w") as f:
26 f.write("done")
27
28 # If the DEPS file changes, GN will know to re-run this script and update the dependencies.
29 deps_file = os.path.join(args.dawn_dir, "DEPS")
30 with open(args.depfile_path, "w") as f:
31 f.write(f"{args.stamp_path}: {deps_file}\n")
32
33 if __name__ == "__main__":
34 main()