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

Side by Side Diff: build/get_syzygy_binaries.py

Issue 866183002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « build/config/arm.gni ('k') | build/secondary/third_party/openmax_dl/dl/BUILD.gn » ('j') | 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 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 raise RuntimeError('Failed to download "%s".' % url) 255 raise RuntimeError('Failed to download "%s".' % url)
256 return response.read() 256 return response.read()
257 257
258 258
259 def _InstallBinaries(options, deleted={}): 259 def _InstallBinaries(options, deleted={}):
260 """Installs Syzygy binaries. This assumes that the output directory has 260 """Installs Syzygy binaries. This assumes that the output directory has
261 already been cleaned, as it will refuse to overwrite existing files.""" 261 already been cleaned, as it will refuse to overwrite existing files."""
262 contents = {} 262 contents = {}
263 state = { 'revision': options.revision, 'contents': contents } 263 state = { 'revision': options.revision, 'contents': contents }
264 archive_url = _SYZYGY_ARCHIVE_URL % { 'revision': options.revision } 264 archive_url = _SYZYGY_ARCHIVE_URL % { 'revision': options.revision }
265 for (base, name, subdir, filt) in _RESOURCES: 265 if options.resources:
266 resources = [(resource, resource, '', None)
267 for resource in options.resources]
268 else:
269 resources = _RESOURCES
270 for (base, name, subdir, filt) in resources:
266 # Create the output directory if it doesn't exist. 271 # Create the output directory if it doesn't exist.
267 fulldir = os.path.join(options.output_dir, subdir) 272 fulldir = os.path.join(options.output_dir, subdir)
268 if os.path.isfile(fulldir): 273 if os.path.isfile(fulldir):
269 raise Exception('File exists where a directory needs to be created: %s' % 274 raise Exception('File exists where a directory needs to be created: %s' %
270 fulldir) 275 fulldir)
271 if not os.path.exists(fulldir): 276 if not os.path.exists(fulldir):
272 _LOGGER.debug('Creating directory: %s', fulldir) 277 _LOGGER.debug('Creating directory: %s', fulldir)
273 if not options.dry_run: 278 if not options.dry_run:
274 os.makedirs(fulldir) 279 os.makedirs(fulldir)
275 280
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 option_parser.add_option('--output-dir', type='string', 319 option_parser.add_option('--output-dir', type='string',
315 help='The path where the binaries will be replaced. Existing binaries ' 320 help='The path where the binaries will be replaced. Existing binaries '
316 'will only be overwritten if not up to date.') 321 'will only be overwritten if not up to date.')
317 option_parser.add_option('--overwrite', action='store_true', default=False, 322 option_parser.add_option('--overwrite', action='store_true', default=False,
318 help='If specified then the installation will happily delete and rewrite ' 323 help='If specified then the installation will happily delete and rewrite '
319 'the entire output directory, blasting any local changes.') 324 'the entire output directory, blasting any local changes.')
320 option_parser.add_option('--revision', type='string', 325 option_parser.add_option('--revision', type='string',
321 help='The SVN revision or GIT hash associated with the required version.') 326 help='The SVN revision or GIT hash associated with the required version.')
322 option_parser.add_option('--revision-file', type='string', 327 option_parser.add_option('--revision-file', type='string',
323 help='A text file containing an SVN revision or GIT hash.') 328 help='A text file containing an SVN revision or GIT hash.')
329 option_parser.add_option('--resource', type='string', action='append',
330 dest='resources', help='A resource to be downloaded.')
324 option_parser.add_option('--verbose', dest='log_level', action='store_const', 331 option_parser.add_option('--verbose', dest='log_level', action='store_const',
325 default=logging.INFO, const=logging.DEBUG, 332 default=logging.INFO, const=logging.DEBUG,
326 help='Enables verbose logging.') 333 help='Enables verbose logging.')
327 option_parser.add_option('--quiet', dest='log_level', action='store_const', 334 option_parser.add_option('--quiet', dest='log_level', action='store_const',
328 default=logging.INFO, const=logging.ERROR, 335 default=logging.INFO, const=logging.ERROR,
329 help='Disables all output except for errors.') 336 help='Disables all output except for errors.')
330 options, args = option_parser.parse_args() 337 options, args = option_parser.parse_args()
331 if args: 338 if args:
332 option_parser.error('Unexpected arguments: %s' % args) 339 option_parser.error('Unexpected arguments: %s' % args)
333 if not options.output_dir: 340 if not options.output_dir:
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 # Install the new binaries. In a dry-run this will actually download the 442 # Install the new binaries. In a dry-run this will actually download the
436 # archives, but it won't write anything to disk. 443 # archives, but it won't write anything to disk.
437 state = _InstallBinaries(options, deleted) 444 state = _InstallBinaries(options, deleted)
438 445
439 # Build and save the state for the directory. 446 # Build and save the state for the directory.
440 _SaveState(options.output_dir, state, options.dry_run) 447 _SaveState(options.output_dir, state, options.dry_run)
441 448
442 449
443 if __name__ == '__main__': 450 if __name__ == '__main__':
444 main() 451 main()
OLDNEW
« no previous file with comments | « build/config/arm.gni ('k') | build/secondary/third_party/openmax_dl/dl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698