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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 pass | 293 pass |
294 else: | 294 else: |
295 raise Exception('Path already exists: %s' % fullpath) | 295 raise Exception('Path already exists: %s' % fullpath) |
296 | 296 |
297 # Extract the file and update the state dictionary. | 297 # Extract the file and update the state dictionary. |
298 _LOGGER.debug('Extracting "%s".', fullpath) | 298 _LOGGER.debug('Extracting "%s".', fullpath) |
299 if not options.dry_run: | 299 if not options.dry_run: |
300 archive.extract(entry.filename, fulldir) | 300 archive.extract(entry.filename, fulldir) |
301 md5 = _Md5(fullpath) | 301 md5 = _Md5(fullpath) |
302 contents[relpath] = md5 | 302 contents[relpath] = md5 |
| 303 if sys.platform == 'cygwin': |
| 304 os.chmod(fullpath, os.stat(fullpath).st_mode | stat.S_IXUSR) |
303 | 305 |
304 return state | 306 return state |
305 | 307 |
306 | 308 |
307 def _ParseCommandLine(): | 309 def _ParseCommandLine(): |
308 """Parses the command-line and returns an options structure.""" | 310 """Parses the command-line and returns an options structure.""" |
309 option_parser = optparse.OptionParser() | 311 option_parser = optparse.OptionParser() |
310 option_parser.add_option('--dry-run', action='store_true', default=False, | 312 option_parser.add_option('--dry-run', action='store_true', default=False, |
311 help='If true then will simply list actions that would be performed.') | 313 help='If true then will simply list actions that would be performed.') |
312 option_parser.add_option('--force', action='store_true', default=False, | 314 option_parser.add_option('--force', action='store_true', default=False, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 354 |
353 # This just makes output prettier to read. | 355 # This just makes output prettier to read. |
354 options.output_dir = os.path.normpath(options.output_dir) | 356 options.output_dir = os.path.normpath(options.output_dir) |
355 | 357 |
356 return options | 358 return options |
357 | 359 |
358 | 360 |
359 def main(): | 361 def main(): |
360 # We only care about Windows platforms, as the Syzygy binaries aren't used | 362 # We only care about Windows platforms, as the Syzygy binaries aren't used |
361 # elsewhere. | 363 # elsewhere. |
362 if sys.platform != 'win32': | 364 if sys.platform not in ('win32', 'cygwin'): |
363 return | 365 return |
364 | 366 |
365 options = _ParseCommandLine() | 367 options = _ParseCommandLine() |
366 | 368 |
367 if options.dry_run: | 369 if options.dry_run: |
368 _LOGGER.debug('Performing a dry-run.') | 370 _LOGGER.debug('Performing a dry-run.') |
369 | 371 |
370 # Load the current installation state, and validate it against the | 372 # Load the current installation state, and validate it against the |
371 # requested installation. | 373 # requested installation. |
372 state, is_consistent = _GetCurrentState(options.revision, options.output_dir) | 374 state, is_consistent = _GetCurrentState(options.revision, options.output_dir) |
(...skipping 26 matching lines...) Expand all Loading... |
399 # Install the new binaries. In a dry-run this will actually download the | 401 # Install the new binaries. In a dry-run this will actually download the |
400 # archives, but it won't write anything to disk. | 402 # archives, but it won't write anything to disk. |
401 state = _InstallBinaries(options, deleted) | 403 state = _InstallBinaries(options, deleted) |
402 | 404 |
403 # Build and save the state for the directory. | 405 # Build and save the state for the directory. |
404 _SaveState(options.output_dir, state, options.dry_run) | 406 _SaveState(options.output_dir, state, options.dry_run) |
405 | 407 |
406 | 408 |
407 if __name__ == '__main__': | 409 if __name__ == '__main__': |
408 main() | 410 main() |
OLD | NEW |