tools_webrtc dir converted to py3 + top level PRESUBMIT script

Bug: webrtc:13607
Change-Id: Ib018e43ea977cc24dd71048e68e3343741f7f31b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249083
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Commit-Queue: Christoffer Jansson <jansson@google.com>
Cr-Commit-Position: refs/heads/main@{#35953}
diff --git a/tools_webrtc/executable_host_build.py b/tools_webrtc/executable_host_build.py
index aac4be0..e8c9aeb 100644
--- a/tools_webrtc/executable_host_build.py
+++ b/tools_webrtc/executable_host_build.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env/python
+#!/usr/bin/env vpython3
 
 # Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
 #
@@ -24,7 +24,7 @@
 You will be able to compile the same executable targeting your host machine
 by running:
 
-  $ python tools_webrtc/executable_host_build.py --executable_name random_exec
+  $ vpython3 tools_webrtc/executable_host_build.py --executable_name random_exec
 
 The generated executable will have the same name as the input executable with
 suffix '_host'.
@@ -62,40 +62,39 @@
 
 
 def _ParseArgs():
-    desc = 'Generates a GN executable targeting the host machine.'
-    parser = argparse.ArgumentParser(description=desc)
-    parser.add_argument('--executable_name',
-                        required=True,
-                        help='Name of the executable to build')
-    args = parser.parse_args()
-    return args
+  desc = 'Generates a GN executable targeting the host machine.'
+  parser = argparse.ArgumentParser(description=desc)
+  parser.add_argument('--executable_name',
+                      required=True,
+                      help='Name of the executable to build')
+  args = parser.parse_args()
+  return args
 
 
 @contextmanager
 def HostBuildDir():
-    temp_dir = tempfile.mkdtemp()
-    try:
-        yield temp_dir
-    finally:
-        shutil.rmtree(temp_dir)
+  temp_dir = tempfile.mkdtemp()
+  try:
+    yield temp_dir
+  finally:
+    shutil.rmtree(temp_dir)
 
 
 def _RunCommand(argv, cwd=SRC_DIR, **kwargs):
-    with open(os.devnull, 'w') as devnull:
-        subprocess.check_call(argv, cwd=cwd, stdout=devnull, **kwargs)
+  with open(os.devnull, 'w') as devnull:
+    subprocess.check_call(argv, cwd=cwd, stdout=devnull, **kwargs)
 
 
 def DepotToolPath(*args):
-    return os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, *args)
+  return os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, *args)
 
 
 if __name__ == '__main__':
-    ARGS = _ParseArgs()
-    EXECUTABLE_TO_BUILD = ARGS.executable_name
-    EXECUTABLE_FINAL_NAME = ARGS.executable_name + '_host'
-    with HostBuildDir() as build_dir:
-        _RunCommand([sys.executable, DepotToolPath('gn.py'), 'gen', build_dir])
-        _RunCommand(
-            [DepotToolPath('ninja'), '-C', build_dir, EXECUTABLE_TO_BUILD])
-        shutil.copy(os.path.join(build_dir, EXECUTABLE_TO_BUILD),
-                    EXECUTABLE_FINAL_NAME)
+  ARGS = _ParseArgs()
+  EXECUTABLE_TO_BUILD = ARGS.executable_name
+  EXECUTABLE_FINAL_NAME = ARGS.executable_name + '_host'
+  with HostBuildDir() as build_dir:
+    _RunCommand([sys.executable, DepotToolPath('gn.py'), 'gen', build_dir])
+    _RunCommand([DepotToolPath('ninja'), '-C', build_dir, EXECUTABLE_TO_BUILD])
+    shutil.copy(os.path.join(build_dir, EXECUTABLE_TO_BUILD),
+                EXECUTABLE_FINAL_NAME)