tor-browser

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

check_rewrapper_cfg.py (1976B)


      1 #!/usr/bin/env python3
      2 # Copyright 2023 The Chromium Authors
      3 # Use of this source code is governed by a BSD-style license that can be
      4 # found in the LICENSE file.
      5 
      6 import os
      7 import sys
      8 
      9 
     10 def missing_cfg_error_message():
     11  """This assumes that corp machine has gcert binary in known location."""
     12  import shutil
     13  if shutil.which("gcert") is not None:
     14    return """
     15 To build with gn arg 'use_remoteexec=true' as a googler on a corp machine
     16 set "download_remoteexec_cfg" in .gclient like
     17 
     18 solutions = [
     19    {
     20        "name"        : "src",
     21        # ...
     22        "custom_vars" : {
     23            "download_remoteexec_cfg": True,
     24        },
     25    },
     26 ]
     27 
     28 and re-run `gclient sync`.
     29 
     30 See http://go/chrome-linux-build#setup-remote-execution
     31 for more details."""
     32  elif sys.platform == 'linux':
     33    return """
     34 To build with gn arg 'use_remoteexec=true' as a googler on a non corp machine
     35 see http://go/chrome-linux-build#setup-remote-execution for setup instructions.
     36 
     37 To build with gn arg 'use_remoteexec=true' as a non-googler set the appropriate
     38 `reclient_cfg_dir` value in args.gn.
     39 See
     40 https://chromium.googlesource.com/chromium/src/+/main/docs/linux/build_instructions.md#use-reclient
     41 for more details."""
     42  else:
     43    return """
     44 To build with gn arg 'use_remoteexec=true' as a googler on a non corp machine
     45 see http://go/chrome-linux-build#setup-remote-execution for setup instructions.
     46 
     47 Building with gn arg 'use_remoteexec=true' as a non-googler is not currently
     48 supported on your os (%s).
     49 """ % sys.platform
     50 
     51 
     52 def main():
     53  if len(sys.argv) != 2:
     54    print("This should have a path to reclient config file in its args.",
     55          file=sys.stderr)
     56    return 1
     57 
     58  # Check path to reclient_cc_cfg_file.
     59  if os.path.isfile(sys.argv[1]):
     60    return 0
     61 
     62  print("reclient config file '%s' doesn't exist" %
     63        (os.path.abspath(sys.argv[1])),
     64        file=sys.stderr)
     65  print(missing_cfg_error_message(), file=sys.stderr)
     66 
     67  return 1
     68 
     69 
     70 if __name__ == "__main__":
     71  sys.exit(main())