2019-02-06 00:54:45 +03:00
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
2024-06-28 23:30:07 +03:00
|
|
|
from lib.util import get_depot_tools_executable
|
2019-07-09 11:40:26 +03:00
|
|
|
|
2019-02-06 00:54:45 +03:00
|
|
|
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')
|
|
|
|
)
|
2019-07-09 11:40:26 +03:00
|
|
|
|
2024-06-28 23:30:07 +03:00
|
|
|
gn_path = get_depot_tools_executable('gn')
|
2019-02-06 00:54:45 +03:00
|
|
|
for gn_file in sys.argv[1:]:
|
|
|
|
subprocess.check_call(
|
2019-07-09 11:40:26 +03:00
|
|
|
[gn_path, 'format', gn_file],
|
2019-02-06 00:54:45 +03:00
|
|
|
env=new_env
|
|
|
|
)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|