Chromium Code Reviews| Index: build/get_syzygy_binaries.py |
| diff --git a/build/get_syzygy_binaries.py b/build/get_syzygy_binaries.py |
| index 1cab3fcf48dfd21f8c54e6492101f9d5df2e6300..78564ebd2270b816b4dc1942b3bd03e6b58c8975 100755 |
| --- a/build/get_syzygy_binaries.py |
| +++ b/build/get_syzygy_binaries.py |
| @@ -7,6 +7,7 @@ |
| import hashlib |
| import errno |
| +import fnmatch |
| import json |
| import logging |
| import optparse |
| @@ -282,6 +283,42 @@ def _Download(resource): |
| return tmp[1] |
| +def _MaybeCopyDIABinaries(options, contents): |
| + """Try to copy the DIA DLL to the binaries exe directory. |
| + |
| + This doesn't check if the toolchain version of this DLL is the same as the |
| + one used by the Syzygy binaries, so this will only be useful if Chrome and |
| + Syzygy are using the same revision of the toolchain. |
| + """ |
| + toolchain_data_file = os.path.join(os.path.dirname(__file__), |
| + 'win_toolchain.json') |
| + if not os.path.exists(toolchain_data_file): |
| + _LOGGER.debug('Toolchain JSON data file doesn\'t exist.') |
| + return |
| + _LOGGER.debug('%s exists' % toolchain_data_file) |
| + with open(toolchain_data_file) as temp_f: |
| + toolchain_data = json.load(temp_f) |
| + if not os.path.isdir(toolchain_data['path']): |
| + _LOGGER.error('The toolchain JSON file is invalid.') |
| + return |
| + dia_sdk_binaries_dir = os.path.join(toolchain_data['path'], 'DIA SDK', 'bin') |
| + for binary in os.listdir(dia_sdk_binaries_dir): |
|
scottmg
2016/10/03 20:20:55
If you're only copying msdia140.dll, why not just
Sébastien Marchand
2016/10/03 20:23:42
Chris had the same question :), I just wanted this
|
| + if fnmatch.fnmatch(binary, 'msdia[0-9][0-9][0-9].dll'): |
| + if binary != 'msdia140.dll': |
|
chrisha
2016/09/29 15:26:58
Lift this to a definition at the top of the file?
|
| + raise Exception('Invalid version, expecting msdia140.dll but got %s' % |
| + binary) |
| + dia_dll = os.path.join(dia_sdk_binaries_dir, binary) |
| + dia_dll_dest = os.path.join(options.output_dir, 'exe', binary) |
| + _LOGGER.debug('Copying %s to %s.' % (dia_dll, dia_dll_dest)) |
| + if not options.dry_run: |
| + shutil.copy(dia_dll, dia_dll_dest) |
| + contents[os.path.relpath(dia_dll_dest, options.output_dir)] = ( |
| + _Md5(dia_dll_dest)) |
| + return |
| + |
| + raise Exception('Unable to find the DIA binaries.') |
| + |
| + |
| def _InstallBinaries(options, deleted={}): |
| """Installs Syzygy binaries. This assumes that the output directory has |
| already been cleaned, as it will refuse to overwrite existing files.""" |
| @@ -336,6 +373,10 @@ def _InstallBinaries(options, deleted={}): |
| _LOGGER.debug('Removing temporary file "%s".', path) |
| os.remove(path) |
| + if options.copy_dia_binaries: |
| + # Try to copy the DIA binaries to the binaries directory. |
| + _MaybeCopyDIABinaries(options, contents) |
| + |
| return state |
| @@ -367,6 +408,9 @@ def _ParseCommandLine(): |
| option_parser.add_option('--quiet', dest='log_level', action='store_const', |
| default=logging.INFO, const=logging.ERROR, |
| help='Disables all output except for errors.') |
| + option_parser.add_option('--copy-dia-binaries', action='store_true', |
| + default=False, help='If true then the DIA dll will get copied into the ' |
| + 'binaries directory if it\'s available.') |
| options, args = option_parser.parse_args() |
| if args: |
| option_parser.error('Unexpected arguments: %s' % args) |