OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import collections | 7 import collections |
8 from datetime import date | 8 from datetime import date |
9 import re | 9 import re |
10 import optparse | 10 import optparse |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 build_utils.WriteDepfile(options.depfile, input_paths + python_deps) | 338 build_utils.WriteDepfile(options.depfile, input_paths + python_deps) |
339 | 339 |
340 if options.srcjar: | 340 if options.srcjar: |
341 if options.print_output_only: | 341 if options.print_output_only: |
342 parser.error('--print_output_only does not work with --srcjar') | 342 parser.error('--print_output_only does not work with --srcjar') |
343 if options.assert_files_list: | 343 if options.assert_files_list: |
344 parser.error('--assert_file does not work with --srcjar') | 344 parser.error('--assert_file does not work with --srcjar') |
345 | 345 |
346 with zipfile.ZipFile(options.srcjar, 'w', zipfile.ZIP_STORED) as srcjar: | 346 with zipfile.ZipFile(options.srcjar, 'w', zipfile.ZIP_STORED) as srcjar: |
347 for output_path, data in DoGenerate(input_paths): | 347 for output_path, data in DoGenerate(input_paths): |
348 srcjar.writestr(build_utils.CreateHermeticZipInfo(output_path), data) | 348 build_utils.AddToZipHermetic(srcjar, output_path, data=data) |
349 else: | 349 else: |
350 # TODO(agrieve): Delete this non-srcjar branch once GYP is gone. | 350 # TODO(agrieve): Delete this non-srcjar branch once GYP is gone. |
351 output_paths = [] | 351 output_paths = [] |
352 for output_path, data in DoGenerate(input_paths): | 352 for output_path, data in DoGenerate(input_paths): |
353 full_path = os.path.join(output_dir, output_path) | 353 full_path = os.path.join(output_dir, output_path) |
354 output_paths.append(full_path) | 354 output_paths.append(full_path) |
355 if not options.print_output_only: | 355 if not options.print_output_only: |
356 build_utils.MakeDirectory(os.path.dirname(full_path)) | 356 build_utils.MakeDirectory(os.path.dirname(full_path)) |
357 with open(full_path, 'w') as out_file: | 357 with open(full_path, 'w') as out_file: |
358 out_file.write(data) | 358 out_file.write(data) |
359 | 359 |
360 if options.assert_files_list: | 360 if options.assert_files_list: |
361 AssertFilesList(output_paths, options.assert_files_list) | 361 AssertFilesList(output_paths, options.assert_files_list) |
362 | 362 |
363 if options.verbose: | 363 if options.verbose: |
364 print 'Output paths:' | 364 print 'Output paths:' |
365 print '\n'.join(output_paths) | 365 print '\n'.join(output_paths) |
366 | 366 |
367 # Used by GYP. | 367 # Used by GYP. |
368 return ' '.join(output_paths) | 368 return ' '.join(output_paths) |
369 | 369 |
370 | 370 |
371 if __name__ == '__main__': | 371 if __name__ == '__main__': |
372 DoMain(sys.argv[1:]) | 372 DoMain(sys.argv[1:]) |
OLD | NEW |