in script/checkout.py [0:0]
def main():
os.chdir(os.path.join(os.path.dirname(__file__), os.pardir))
parser = common.create_parser(True)
args = parser.parse_args()
# Clone depot_tools
if not os.path.exists("depot_tools"):
subprocess.check_call(["git", "clone", "--config", "core.autocrlf=input", "https://chromium.googlesource.com/chromium/tools/depot_tools.git", "depot_tools"])
match = re.match('(m\\d+)(?:-([0-9a-f]+)(?:-([1-9][0-9]*))?)?', args.version)
if not match:
raise Exception('Expected --version "m<ver>-<sha>", got "' + args.version + '"')
commit = match.group(2)
checkout_skia(commit)
# git deps
print("> Running tools/git-sync-deps")
# Trying to avoid 429 HTTP Error from Google repos
git_sync_with_retries()
# fetch ninja
print("> Fetching ninja")
subprocess.check_call(["python3", "bin/fetch-ninja"])
# Patch an issue in Windows toolchain:
# Enable delayed environment variable expansion for CMD to make GitHub Actions happy
# https://issues.skia.org/issues/393402169
with open("gn/toolchain/BUILD.gn", "r") as toolchain_file:
toolchain_file_contents = toolchain_file.read()
toolchain_file_contents = toolchain_file_contents.replace(
'shell = "cmd.exe /c',
'shell = "cmd.exe /v:on /c',
).replace(
r'env_setup = "$shell set \"PATH=%PATH%',
r'env_setup = "$shell set \"PATH=!PATH!',
)
with open("gn/toolchain/BUILD.gn", "w") as toolchain_file:
toolchain_file.write(toolchain_file_contents)
return 0