Path: blob/main_old/tools/flex-bison/update_flex_bison_binaries.py
2585 views
#!/usr/bin/python21#2# Copyright 2019 The ANGLE Project Authors. All rights reserved.3# Use of this source code is governed by a BSD-style license that can be4# found in the LICENSE file.5#6# update_flex_bison_binaries.py:7# Helper script to update the version of flex and bison in cloud storage.8# These binaries are used to generate the ANGLE translator's lexer and parser.9# This script relies on flex and bison binaries to be externally built which10# is expected to be a rare operation. It currently only works on Windows and11# Linux. It also will update the hashes stored in the tree. For more info see12# README.md in this folder.1314import os15import platform16import shutil17import sys1819sys.path.append('tools/')20import angle_tools212223def main():24if angle_tools.is_linux:25subdir = 'linux'26files = ['flex', 'bison']27elif angle_tools.is_windows:28subdir = 'windows'29files = [30'flex.exe', 'bison.exe', 'm4.exe', 'msys-2.0.dll', 'msys-iconv-2.dll',31'msys-intl-8.dll'32]33else:34print('Script must be run on Linux or Windows.')35return 13637files = [os.path.join(sys.path[0], subdir, f) for f in files]3839# Step 1: Upload to cloud storage40if not angle_tools.upload_to_google_storage('angle-flex-bison', files):41print('Error upload to cloud storage')42return 14344# Step 2: Stage new SHA to git45if not angle_tools.stage_google_storage_sha1(files):46print('Error running git add')47return 24849print('')50print('The updated SHA has been staged for commit. Please commit and upload.')51print('Suggested commit message (please indicate flex/bison versions):')52print('----------------------------')53print('')54print('Update flex and bison binaries for %s.' % platform.system())55print('')56print('These binaries were updated using %s.' % os.path.basename(__file__))57print('Please see instructions in tools/flex-bison/README.md.')58print('')59print('flex is at version TODO.')60print('bison is at version TODO.')61print('')62print('Bug: None')6364return 0656667if __name__ == '__main__':68sys.exit(main())697071