tor-browser

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

process_native_prebuilt.py (1179B)


      1 #!/usr/bin/env python3
      2 #
      3 # Copyright 2020 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 import argparse
      8 import os
      9 import shutil
     10 import sys
     11 
     12 from util import build_utils
     13 import action_helpers  # build_utils adds //build to sys.path.
     14 
     15 
     16 def main(args):
     17  parser = argparse.ArgumentParser(args)
     18  parser.add_argument('--strip-path', required=True, help='')
     19  parser.add_argument('--input-path', required=True, help='')
     20  parser.add_argument('--stripped-output-path', required=True, help='')
     21  parser.add_argument('--unstripped-output-path', required=True, help='')
     22  options = parser.parse_args(args)
     23 
     24  # eu-strip's output keeps mode from source file which might not be writable
     25  # thus it fails to override its output on the next run. AtomicOutput fixes
     26  # the issue.
     27  with action_helpers.atomic_output(options.stripped_output_path) as out:
     28    cmd = [
     29        options.strip_path,
     30        options.input_path,
     31        '-o',
     32        out.name,
     33    ]
     34    build_utils.CheckOutput(cmd)
     35  shutil.copyfile(options.input_path, options.unstripped_output_path)
     36 
     37 
     38 if __name__ == '__main__':
     39  main(sys.argv[1:])