Make Win runtime DLLs writeable before overwriting
This should fix the VS2015 bot which is failing because we can't
overwrite read-only DLL files.
BUG=skia:4553
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1813233002
Review URL: https://codereview.chromium.org/1813233002
diff --git a/gyp_skia b/gyp_skia
index 91d93ca..ed6d383 100755
--- a/gyp_skia
+++ b/gyp_skia
@@ -13,6 +13,7 @@
import os
import platform
import shlex
+import stat
import sys
script_dir = os.path.abspath(os.path.dirname(__file__))
@@ -90,7 +91,7 @@
print ('%s environment variable not set, using default, %s' %
(ENVVAR_GYP_GENERATORS, default_gyp_generators))
- vs2013_runtime_dll_dirs = None
+ vs_runtime_dll_dirs = None
if os.getenv('CHROME_HEADLESS', '0') == '1':
if sys.platform.startswith('win') or sys.platform.startswith('cygwin'):
chrome_path = os.getenv('CHROME_PATH')
@@ -98,7 +99,7 @@
sys.path.append(os.path.join(chrome_path, 'build'))
sys.path.append(os.path.join(chrome_path, 'tools'))
import vs_toolchain
- vs2013_runtime_dll_dirs = \
+ vs_runtime_dll_dirs = \
vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
# Set CWD to the directory containing this script.
@@ -127,7 +128,8 @@
args.extend(['--depth', '.'])
# Tell gyp to write the build files into output_dir.
- args.extend(['--generator-output', os.path.abspath(get_output_dir())])
+ out_dir = os.path.abspath(get_output_dir())
+ args.extend(['--generator-output', out_dir])
# Tell ninja to write its output into the same directory.
args.extend(['-Goutput_dir=%s' % gyp_output_dir])
@@ -158,8 +160,15 @@
# This code is copied from Chrome's build/gyp_chromium. It's not clear why
# the *_runtime variables are reversed.
- if vs2013_runtime_dll_dirs:
- x64_runtime, x86_runtime = vs2013_runtime_dll_dirs
+ if vs_runtime_dll_dirs:
+ # The DLLs might be read-only, which will cause an error when attempting to
+ # overwrite them. Make them writeable first.
+ for path, dirs, files in os.walk(out_dir):
+ for f in files:
+ if f.endswith('.dll'):
+ os.chmod(os.path.join(path, f), stat.S_IWRITE)
+
+ x64_runtime, x86_runtime = vs_runtime_dll_dirs
vs_toolchain.CopyVsRuntimeDlls(
- os.path.join(os.getenv('CHROME_PATH'), get_output_dir()),
+ os.path.join(os.getenv('CHROME_PATH'), out_dir),
(x86_runtime, x64_runtime))