Reformat python files checked by pylint (part 1/2).
After recently changing .pylintrc (see [1]) we discovered that
the presubmit check always checks all the python files when just
one python file gets updated.
This CL moves all these files one step closer to what the linter
wants.
Autogenerated with:
# Added all the files under pylint control to ~/Desktop/to-reformat
cat ~/Desktop/to-reformat | xargs sed -i '1i\\'
git cl format --python --full
This is part 1 out of 2. The second part will fix function names and
will not be automated.
[1] - https://webrtc-review.googlesource.com/c/src/+/186664
No-Presubmit: True
Bug: webrtc:12114
Change-Id: Idfec4d759f209a2090440d0af2413a1ddc01b841
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190980
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32530}
diff --git a/tools_webrtc/executable_host_build.py b/tools_webrtc/executable_host_build.py
index cc1e7ee..aac4be0 100644
--- a/tools_webrtc/executable_host_build.py
+++ b/tools_webrtc/executable_host_build.py
@@ -55,7 +55,6 @@
import sys
import tempfile
-
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir))
sys.path.append(os.path.join(SRC_DIR, 'build'))
@@ -63,39 +62,40 @@
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)