build: fix clang format location helper (#42926)

* build: fix clang format location helper (again)

* use gclient sync in lint workflow for downloading clang-format
This commit is contained in:
Calvin 2024-07-17 02:30:36 -07:00 committed by GitHub
parent 85cb6d9476
commit 5951712f2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 11 deletions

View file

@ -4,6 +4,7 @@ import contextlib
import errno
import json
import os
import platform
import shutil
import subprocess
import sys
@ -184,14 +185,20 @@ def get_electron_exec():
def get_buildtools_executable(name):
buildtools = os.path.realpath(os.path.join(ELECTRON_DIR, '..', 'buildtools'))
chromium_platform = {
'darwin': 'mac',
'linux': 'linux64',
'linux2': 'linux64',
'win32': 'win',
'cygwin': 'win',
}[sys.platform]
path = os.path.join(buildtools, chromium_platform, name)
if sys.platform == 'darwin':
chromium_platform = 'mac_arm64' if platform.machine() == 'arm64' else 'mac'
elif sys.platform in ['win32', 'cygwin']:
chromium_platform = 'win'
elif sys.platform in ['linux', 'linux2']:
chromium_platform = 'linux64'
else:
raise Exception(f"Unsupported platform: {sys.platform}")
if name == 'clang-format':
path = os.path.join(buildtools, chromium_platform, 'format', name)
else:
path = os.path.join(buildtools, chromium_platform, name)
if sys.platform == 'win32':
path += '.exe'
return path