electron/script/run-gn-format.py
Keeley Hammond bdf8c75d33
build: fix clang format/lint (#42717)
build: fix clang format/lint (#42715)

* build: fix clang format path

* fix: use gclient sync instead of gclient runhooks

Refs https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5659261

* fix: use gclient sync instead of gclient runhooks in GHA

---------

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2024-06-28 13:39:44 -07:00

26 lines
645 B
Python

import os
import subprocess
import sys
from lib.util import get_depot_tools_executable
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
# Helper to run gn format on multiple files
# (gn only formats a single file at a time)
def main():
new_env = os.environ.copy()
new_env['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
new_env['CHROMIUM_BUILDTOOLS_PATH'] = os.path.realpath(
os.path.join(SOURCE_ROOT, '..', 'buildtools')
)
gn_path = get_depot_tools_executable('gn')
for gn_file in sys.argv[1:]:
subprocess.check_call(
[gn_path, 'format', gn_file],
env=new_env
)
if __name__ == '__main__':
sys.exit(main())