Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Side by Side Diff: build/win/copy_cdb_to_output.py

Issue 2030723002: Handle case where WINDOWSSDKDIR is not set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing indentation Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 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 hashlib 6 import hashlib
7 import os 7 import os
8 import shutil 8 import shutil
9 import sys 9 import sys
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 def _CopyCDBToOutput(output_dir, target_arch): 46 def _CopyCDBToOutput(output_dir, target_arch):
47 """Copies the Windows debugging executable cdb.exe to the output 47 """Copies the Windows debugging executable cdb.exe to the output
48 directory, which is created if it does not exist. The output 48 directory, which is created if it does not exist. The output
49 directory, and target architecture that should be copied, are 49 directory, and target architecture that should be copied, are
50 passed. Supported values for the target architecture are the GYP 50 passed. Supported values for the target architecture are the GYP
51 values "ia32" and "x64" and the GN values "x86" and "x64". 51 values "ia32" and "x64" and the GN values "x86" and "x64".
52 """ 52 """
53 if not os.path.isdir(output_dir): 53 if not os.path.isdir(output_dir):
54 os.makedirs(output_dir) 54 os.makedirs(output_dir)
55 vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() 55 vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
56 win_sdk_dir = os.path.normpath(os.environ['WINDOWSSDKDIR']) 56 # If WINDOWSSDKDIR is not set use the default SDK path. This will be the case
57 # when DEPOT_TOOLS_WIN_TOOLCHAIN=0 and vcvarsall.bat has not been run.
58 win_sdk_dir = os.path.normpath(
59 os.environ.get('WINDOWSSDKDIR',
60 'C:\\Program Files (x86)\\Windows Kits\\10'))
57 if target_arch == 'ia32' or target_arch == 'x86': 61 if target_arch == 'ia32' or target_arch == 'x86':
58 src_arch = 'x86' 62 src_arch = 'x86'
59 elif target_arch == 'x64': 63 elif target_arch == 'x64':
60 src_arch = 'x64' 64 src_arch = 'x64'
61 else: 65 else:
62 print 'copy_cdb_to_output.py: unknown target_arch %s' % target_arch 66 print 'copy_cdb_to_output.py: unknown target_arch %s' % target_arch
63 sys.exit(1) 67 sys.exit(1)
64 # We need to copy multiple files, so cache the computed source directory. 68 # We need to copy multiple files, so cache the computed source directory.
65 src_dir = os.path.join(win_sdk_dir, 'Debuggers', src_arch) 69 src_dir = os.path.join(win_sdk_dir, 'Debuggers', src_arch)
66 # Note that the outputs from the "copy_cdb_to_output" target need to 70 # Note that the outputs from the "copy_cdb_to_output" target need to
67 # be kept in sync with this list. 71 # be kept in sync with this list.
68 _CopyImpl('cdb.exe', output_dir, src_dir) 72 _CopyImpl('cdb.exe', output_dir, src_dir)
69 _CopyImpl('dbgeng.dll', output_dir, src_dir) 73 _CopyImpl('dbgeng.dll', output_dir, src_dir)
70 _CopyImpl('dbghelp.dll', output_dir, src_dir) 74 _CopyImpl('dbghelp.dll', output_dir, src_dir)
71 _CopyImpl('dbgmodel.dll', output_dir, src_dir) 75 _CopyImpl('dbgmodel.dll', output_dir, src_dir)
72 return 0 76 return 0
73 77
74 78
75 def main(): 79 def main():
76 if len(sys.argv) < 2: 80 if len(sys.argv) < 2:
77 print >>sys.stderr, 'Usage: copy_cdb_to_output.py <output_dir> ' + \ 81 print >>sys.stderr, 'Usage: copy_cdb_to_output.py <output_dir> ' + \
78 '<target_arch>' 82 '<target_arch>'
79 return 1 83 return 1
80 return _CopyCDBToOutput(sys.argv[1], sys.argv[2]) 84 return _CopyCDBToOutput(sys.argv[1], sys.argv[2])
81 85
82 86
83 if __name__ == '__main__': 87 if __name__ == '__main__':
84 sys.exit(main()) 88 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698