OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import glob | 6 import glob |
7 import json | 7 import json |
8 import os | 8 import os |
9 import pipes | 9 import pipes |
10 import shutil | 10 import shutil |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 def _CopyRuntime2013(target_dir, source_dir, dll_pattern): | 169 def _CopyRuntime2013(target_dir, source_dir, dll_pattern): |
170 """Copy both the msvcr and msvcp runtime DLLs, only if the target doesn't | 170 """Copy both the msvcr and msvcp runtime DLLs, only if the target doesn't |
171 exist, but the target directory does exist.""" | 171 exist, but the target directory does exist.""" |
172 for file_part in ('p', 'r'): | 172 for file_part in ('p', 'r'): |
173 dll = dll_pattern % file_part | 173 dll = dll_pattern % file_part |
174 target = os.path.join(target_dir, dll) | 174 target = os.path.join(target_dir, dll) |
175 source = os.path.join(source_dir, dll) | 175 source = os.path.join(source_dir, dll) |
176 _CopyRuntimeImpl(target, source) | 176 _CopyRuntimeImpl(target, source) |
177 | 177 |
178 | 178 |
179 def _CopyRuntime2015(target_dir, source_dir, dll_pattern): | 179 def _CopyRuntime2015(target_dir, source_dir, dll_pattern, suffix): |
180 """Copy both the msvcp and vccorlib runtime DLLs, only if the target doesn't | 180 """Copy both the msvcp and vccorlib runtime DLLs, only if the target doesn't |
181 exist, but the target directory does exist.""" | 181 exist, but the target directory does exist.""" |
182 for file_part in ('msvcp', 'vccorlib', 'vcruntime'): | 182 for file_part in ('msvcp', 'vccorlib', 'vcruntime'): |
183 dll = dll_pattern % file_part | 183 dll = dll_pattern % file_part |
184 target = os.path.join(target_dir, dll) | 184 target = os.path.join(target_dir, dll) |
185 source = os.path.join(source_dir, dll) | 185 source = os.path.join(source_dir, dll) |
186 _CopyRuntimeImpl(target, source) | 186 _CopyRuntimeImpl(target, source) |
187 ucrt_src_dir = os.path.join(source_dir, 'api-ms-win-*.dll') | |
188 print 'Copying %s to %s...' % (ucrt_src_dir, target_dir) | |
Nico
2016/02/22 21:01:06
consider removing print, the other _CopyRuntimeImp
brucedawson
2016/02/22 21:20:11
The print is here because _CopyRuntimeImpl is call
| |
189 for ucrt_src_file in glob.glob(ucrt_src_dir): | |
190 file_part = os.path.basename(ucrt_src_file) | |
191 ucrt_dst_file = os.path.join(target_dir, file_part) | |
192 _CopyRuntimeImpl(ucrt_dst_file, ucrt_src_file, False) | |
193 _CopyRuntimeImpl(os.path.join(target_dir, 'ucrtbase' + suffix), | |
194 os.path.join(source_dir, 'ucrtbase' + suffix)) | |
187 | 195 |
188 | 196 |
189 def _CopyRuntime(target_dir, source_dir, target_cpu, debug): | 197 def _CopyRuntime(target_dir, source_dir, target_cpu, debug): |
190 """Copy the VS runtime DLLs, only if the target doesn't exist, but the target | 198 """Copy the VS runtime DLLs, only if the target doesn't exist, but the target |
191 directory does exist. Handles VS 2013 and VS 2015.""" | 199 directory does exist. Handles VS 2013 and VS 2015.""" |
192 suffix = "d.dll" if debug else ".dll" | 200 suffix = "d.dll" if debug else ".dll" |
193 if GetVisualStudioVersion() == '2015': | 201 if GetVisualStudioVersion() == '2015': |
194 _CopyRuntime2015(target_dir, source_dir, '%s140' + suffix) | 202 _CopyRuntime2015(target_dir, source_dir, '%s140' + suffix, suffix) |
195 ucrt_src_dir = os.path.join(source_dir, 'api-ms-win-*.dll') | |
196 print 'Copying %s to %s...' % (ucrt_src_dir, target_dir) | |
197 for ucrt_src_file in glob.glob(ucrt_src_dir): | |
198 file_part = os.path.basename(ucrt_src_file) | |
199 ucrt_dst_file = os.path.join(target_dir, file_part) | |
200 _CopyRuntimeImpl(ucrt_dst_file, ucrt_src_file, False) | |
201 _CopyRuntimeImpl(os.path.join(target_dir, 'ucrtbase' + suffix), | |
202 os.path.join(source_dir, 'ucrtbase' + suffix)) | |
203 else: | 203 else: |
204 _CopyRuntime2013(target_dir, source_dir, 'msvc%s120' + suffix) | 204 _CopyRuntime2013(target_dir, source_dir, 'msvc%s120' + suffix) |
205 | 205 |
206 # Copy the PGO runtime library to the release directories. | 206 # Copy the PGO runtime library to the release directories. |
207 if not debug and os.environ.get('GYP_MSVS_OVERRIDE_PATH'): | 207 if not debug and os.environ.get('GYP_MSVS_OVERRIDE_PATH'): |
208 pgo_x86_runtime_dir = os.path.join(os.environ.get('GYP_MSVS_OVERRIDE_PATH'), | 208 pgo_x86_runtime_dir = os.path.join(os.environ.get('GYP_MSVS_OVERRIDE_PATH'), |
209 'VC', 'bin') | 209 'VC', 'bin') |
210 pgo_x64_runtime_dir = os.path.join(pgo_x86_runtime_dir, 'amd64') | 210 pgo_x64_runtime_dir = os.path.join(pgo_x86_runtime_dir, 'amd64') |
211 pgo_runtime_dll = 'pgort' + _VersionNumber() + '.dll' | 211 pgo_runtime_dll = 'pgort' + _VersionNumber() + '.dll' |
212 if target_cpu == "x86": | 212 if target_cpu == "x86": |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 'copy_dlls': CopyDlls, | 360 'copy_dlls': CopyDlls, |
361 } | 361 } |
362 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 362 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
363 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 363 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
364 return 1 | 364 return 1 |
365 return commands[sys.argv[1]](*sys.argv[2:]) | 365 return commands[sys.argv[1]](*sys.argv[2:]) |
366 | 366 |
367 | 367 |
368 if __name__ == '__main__': | 368 if __name__ == '__main__': |
369 sys.exit(main()) | 369 sys.exit(main()) |
OLD | NEW |