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 """A utility script for downloading versioned Syzygy binaries.""" | 6 """A utility script for downloading versioned Syzygy binaries.""" |
7 | 7 |
8 import cStringIO | 8 import cStringIO |
9 import hashlib | 9 import hashlib |
10 import errno | 10 import errno |
(...skipping 28 matching lines...) Expand all Loading... |
39 # This matches an MD5 hash. | 39 # This matches an MD5 hash. |
40 _MD5_RE = re.compile('^[a-f0-9]{32}$') | 40 _MD5_RE = re.compile('^[a-f0-9]{32}$') |
41 | 41 |
42 # List of reources to be downloaded and installed. These are tuples with the | 42 # List of reources to be downloaded and installed. These are tuples with the |
43 # following format: | 43 # following format: |
44 # (basename, logging name, relative installation path, extraction filter) | 44 # (basename, logging name, relative installation path, extraction filter) |
45 _RESOURCES = [ | 45 _RESOURCES = [ |
46 ('benchmark.zip', 'benchmark', '', None), | 46 ('benchmark.zip', 'benchmark', '', None), |
47 ('binaries.zip', 'binaries', 'exe', None), | 47 ('binaries.zip', 'binaries', 'exe', None), |
48 ('symbols.zip', 'symbols', 'exe', | 48 ('symbols.zip', 'symbols', 'exe', |
49 lambda x: x.filename.endswith('.dll.pdb')), | 49 lambda x: x.filename.endswith('.dll.pdb'))] |
50 ('include.zip', 'include', 'include', None), | |
51 ('lib.zip', 'library', 'lib', None)] | |
52 | 50 |
53 | 51 |
54 def _Shell(*cmd, **kw): | 52 def _Shell(*cmd, **kw): |
55 """Runs |cmd|, returns the results from Popen(cmd).communicate().""" | 53 """Runs |cmd|, returns the results from Popen(cmd).communicate().""" |
56 _LOGGER.debug('Executing %s.', cmd) | 54 _LOGGER.debug('Executing %s.', cmd) |
57 prog = subprocess.Popen(cmd, shell=True, **kw) | 55 prog = subprocess.Popen(cmd, shell=True, **kw) |
58 | 56 |
59 stdout, stderr = prog.communicate() | 57 stdout, stderr = prog.communicate() |
60 if prog.returncode != 0: | 58 if prog.returncode != 0: |
61 raise RuntimeError('Command "%s" returned %d.' % (cmd, prog.returncode)) | 59 raise RuntimeError('Command "%s" returned %d.' % (cmd, prog.returncode)) |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 # Install the new binaries. In a dry-run this will actually download the | 435 # Install the new binaries. In a dry-run this will actually download the |
438 # archives, but it won't write anything to disk. | 436 # archives, but it won't write anything to disk. |
439 state = _InstallBinaries(options, deleted) | 437 state = _InstallBinaries(options, deleted) |
440 | 438 |
441 # Build and save the state for the directory. | 439 # Build and save the state for the directory. |
442 _SaveState(options.output_dir, state, options.dry_run) | 440 _SaveState(options.output_dir, state, options.dry_run) |
443 | 441 |
444 | 442 |
445 if __name__ == '__main__': | 443 if __name__ == '__main__': |
446 main() | 444 main() |
OLD | NEW |