* fix: use gn/clang-format from src * fix: download clang-format in lint job * chore: fix linting warning * chore: get_path_in_buildtools => get_buildtools_executable * chore: the clang-format npm package is not used
		
			
				
	
	
		
			26 lines
		
	
	
	
		
			643 B
			
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
	
		
			643 B
			
		
	
	
	
		
			Python
		
	
	
	
	
	
import os
 | 
						|
import subprocess
 | 
						|
import sys
 | 
						|
 | 
						|
from lib.util import get_buildtools_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_buildtools_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())
 |