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 """Compare the artifacts from two builds.""" | 6 """Compare the artifacts from two builds.""" |
7 | 7 |
8 import difflib | 8 import difflib |
9 import json | 9 import json |
10 import optparse | 10 import optparse |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 parser = optparse.OptionParser(usage='%prog [options]') | 568 parser = optparse.OptionParser(usage='%prog [options]') |
569 parser.add_option( | 569 parser.add_option( |
570 '-f', '--first-build-dir', help='The first build directory.') | 570 '-f', '--first-build-dir', help='The first build directory.') |
571 parser.add_option( | 571 parser.add_option( |
572 '-s', '--second-build-dir', help='The second build directory.') | 572 '-s', '--second-build-dir', help='The second build directory.') |
573 parser.add_option('-r', '--recursive', action='store_true', default=False, | 573 parser.add_option('-r', '--recursive', action='store_true', default=False, |
574 help='Indicates if the comparison should be recursive.') | 574 help='Indicates if the comparison should be recursive.') |
575 target = { | 575 target = { |
576 'darwin': 'mac', 'linux2': 'linux', 'win32': 'win' | 576 'darwin': 'mac', 'linux2': 'linux', 'win32': 'win' |
577 }.get(sys.platform, sys.platform) | 577 }.get(sys.platform, sys.platform) |
578 parser.add_option('-t', '--target-platform', help='The target platform.' | 578 parser.add_option('-t', '--target-platform', help='The target platform.', |
579 default=target, choices=('android', 'mac', 'linux', 'win')) | 579 default=target, choices=('android', 'mac', 'linux', 'win')) |
580 options, _ = parser.parse_args() | 580 options, _ = parser.parse_args() |
581 | 581 |
582 if not options.first_build_dir: | 582 if not options.first_build_dir: |
583 parser.error('--first-build-dir is required') | 583 parser.error('--first-build-dir is required') |
584 if not options.second_build_dir: | 584 if not options.second_build_dir: |
585 parser.error('--second-build-dir is required') | 585 parser.error('--second-build-dir is required') |
586 if not options.target_platform: | 586 if not options.target_platform: |
587 parser.error('--target-platform is required') | 587 parser.error('--target-platform is required') |
588 | 588 |
589 return compare_build_artifacts(os.path.abspath(options.first_build_dir), | 589 return compare_build_artifacts(os.path.abspath(options.first_build_dir), |
590 os.path.abspath(options.second_build_dir), | 590 os.path.abspath(options.second_build_dir), |
591 options.target_platform, | 591 options.target_platform, |
592 options.recursive) | 592 options.recursive) |
593 | 593 |
594 | 594 |
595 if __name__ == '__main__': | 595 if __name__ == '__main__': |
596 sys.exit(main()) | 596 sys.exit(main()) |
OLD | NEW |