tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

write_rustflags.py (983B)


      1 #!/usr/bin/env vpython3
      2 
      3 # Copyright 2024 The Chromium Authors
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 
      7 # Writes all command line arguments to a file, separated by newlines.
      8 
      9 import argparse
     10 import os
     11 import sys
     12 
     13 # Set up path to be able to import action_helpers
     14 sys.path.append(
     15    os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,
     16                 os.pardir, 'build'))
     17 import action_helpers
     18 
     19 
     20 def main():
     21  parser = argparse.ArgumentParser(description='Run Rust build script.')
     22  parser.add_argument('--output', required=True, help='output file')
     23  args, flags = parser.parse_known_args()
     24  # AtomicOutput will ensure we only write to the file on disk if what we
     25  # give to write() is different than what's currently on disk.
     26  with action_helpers.atomic_output(args.output) as output:
     27    output.write(b'\n'.join([f.encode('utf-8') for f in flags]))
     28 
     29 
     30 if __name__ == '__main__':
     31  sys.exit(main())