Hash :
2be8c8cc
Author :
Date :
2016-04-28T14:39:15
Add script for updating Canary ANGLE DLLs. This script makes debugging in Chrome easier on Windows. It scans for the latest set of ANGLE DLLs among many search paths, and then copies them to the latest Chrome Canary binary directory. It also backs up the original DLLs if it finds them. BUG=None Change-Id: I66f8897a1393ceba8f614e4f91c0e1f9f0439eb3 Reviewed-on: https://chromium-review.googlesource.com/341221 Reviewed-by: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#!/usr/bin/python
#
# Copyright 2016 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# update_canary_angle.py:
# Helper script that copies Windows ANGLE DLLs into the Canary
# application directory. Much faster than compiling Chrome from
# source. The script checks for the most recent DLLs in a set of
# search paths, and copies that into the most recent Canary
# binary folder. Only works on Windows.
import sys, os, shutil
# Set of search paths.
source_paths = [
os.path.join('..', 'build', 'Debug_x64'),
os.path.join('..', 'build', 'Debug_Win32'),
os.path.join('..', 'build', 'Release_x64'),
os.path.join('..', 'build', 'Release_Win32'),
os.path.join('..', 'out', 'Debug'),
os.path.join('..', 'out', 'Debug_x64'),
os.path.join('..', 'out', 'Release'),
os.path.join('..', 'out', 'Release_x64'),
]
# Default Canary installation path.
chrome_folder = os.path.join(os.environ['LOCALAPPDATA'], 'Google', 'Chrome SxS', 'Application')
# Find the most recent ANGLE DLLs
binary_name = 'libGLESv2.dll'
newest_folder = None
newest_mtime = None
for path in source_paths:
binary_path = os.path.join(path, binary_name)
if os.path.exists(binary_path):
binary_mtime = os.path.getmtime(binary_path)
if (newest_folder is None) or (binary_mtime > newest_mtime):
newest_folder = path
newest_mtime = binary_mtime
source_folder = newest_folder
# Is a folder a chrome binary directory?
def is_chrome_bin(str):
chrome_file = os.path.join(chrome_folder, str)
return os.path.isdir(chrome_file) and all([char.isdigit() or char == '.' for char in str])
sorted_chrome_bins = sorted([folder for folder in os.listdir(chrome_folder) if is_chrome_bin(folder)], reverse=True)
dest_folder = os.path.join(chrome_folder, sorted_chrome_bins[0])
print('Copying DLLs from ' + source_folder + ' to ' + dest_folder + '.')
# Translator.dll appears if we build in component=shared_library mode.
for dll in ['libGLESv2.dll', 'libEGL.dll', 'translator.dll']:
src = os.path.join(source_folder, dll)
if os.path.exists(src):
# Make a backup of the original unmodified DLLs if they are present.
backup = os.path.join(source_folder, dll + '.backup')
if not os.path.exists(backup):
shutil.copyfile(src, backup)
shutil.copyfile(src, os.path.join(dest_folder, dll))